高级控件
1. TreeView
//1.1 添加节点
TreeNode tn1 = treeView1.Nodes.Add(
"名称"
);
TreeNode tn2 = treeView1.Nodes.Add(
"类别"
);
TreeNode subA_tn1 =
new
TreeNode(
"A"
);
TreeNode subB_tn1 =
new
TreeNode(
"B"
);
TreeNode subC_tn1 =
new
TreeNode(
"C"
);
tn1.Nodes.Add(subA_tn1);
tn1.Nodes.Add(subB_tn1);
tn1.Nodes.Add(subC_tn1);
TreeNode sub1_tn2 =
new
TreeNode(
"1"
);
TreeNode sub2_tn2 =
new
TreeNode(
"2"
);
TreeNode sub3_tn2 =
new
TreeNode(
"3"
);
tn2.Nodes.Add(sub1_tn2);
tn2.Nodes.Add(sub2_tn2);
tn2.Nodes.Add(sub3_tn2);
//1.2 移除节点
private
void
button1_Click(
object
sender, EventArgs e)
{
treeView1.Nodes.Remove(treeView1.SelectedNode);
}
//1.3 为节点设置图标
imageList1.Images.Add(Image.FromFile(
"图片地址1"
));
imageList1.Images.Add(Image.FromFile(
"图片地址2"
));
treeView1.ImageList = imageList1;
treeView1.ImageIndex = 0;
treeView1.SelectedImageIndex = 1;
|
2. ProgressBar
progressBar1.Value = 0;
progressBar1.Minimum = 0;
progressBar1.Maximum = 500;
progressBar1.Step = 1;
for
(
int
i=0; i<=500; i++)
{
progressBar1.PerformStep();
}
|
本文转自静默虚空博客园博客,原文链接:http://www.cnblogs.com/jingmoxukong/articles/2132273.html,如需转载请自行联系原作者