修改label标签的高度宽度:
label的autosize设为false,就能改label的大小了。
设置linklable控件的链接事件
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("iexplore.exe", "http://www.uestc.edu.cn/");
}
利用点击Treeview中每一个节点,右边SplitContainer中Panel显示相对应的窗体
public
class
Form1
{
SplitContainer sp =
new
SplitContainer();
TreeView tree =
new
TreeView();
private
void
Form1_Load(
object
sender, System.EventArgs e)
{
tree.Nodes.Add(
"Form1"
);
tree.Nodes.Add(
"Form2"
);
tree.Nodes.Add(
"Test"
);
sp.Panel1.Controls.Add(tree);
tree.Dock = DockStyle.Fill;
this
.Controls.Add(sp);
sp.Dock = DockStyle.Fill;
tree.AfterSelect += AfterSelect;
}
private
void
AfterSelect(
object
sender, TreeViewEventArgs e)
{
sp.Panel2.Controls.Clear();
switch
(e.Node.Text) {
case
"Form1"
:
Form frm =
new
Form();
frm.Text = e.Node.Text;
frm.TopLevel =
false
;
sp.Panel2.Controls.Add(frm);
frm.Show();
break
;
case
"Form2"
:
Form frm =
new
Form();
frm.Text = e.Node.Text;
frm.TopLevel =
false
;
sp.Panel2.Controls.Add(frm);
frm.Show();
break
;
default
:
Form frm =
new
Form();
frm.Text =
"Test"
;
frm.TopLevel =
false
;
sp.Panel2.Controls.Add(frm);
frm.Show();
break
;
}
}
}