首页 > 代码库 > C# treeview 使用笔记

C# treeview 使用笔记

treeView默认 展开
treeView1.ExpandAll();

treeview判断点击节点:

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)        {            if (treeView1.SelectedNode.Name == "节点名")            {                 frm_cluster.ShowDialog();            }}

 treeview 点击已经选过的节点如何触发事件:

  private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)        {            if (treeView1.SelectedNode.Name == "cluster")            {                frm_cluster.ShowDialog();            }            treeView1.SelectedNode = null;        }

在AfterSelect事件的末尾处,添加:treeView1.SelectedNode = null;

C# treeview 使用笔记