开发者

C# treeview node

I have a treeview1:

             treenode--
               开发者_StackOverflow社区   treenode1--
                     treenode2
                     treenode3

You can select only node2 and node3 if you want to display them parameters. How can i block selecting node and node1? I try like that,but than you can select all nodes:

    private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
    {
    ...
     }


you will have to use SelectAction Property on the tree node. you will need to set it on the node when you are creating them.

set selectaction=none on node and node1


If it's a win forms TreeView handle the BeforeSelect event and set the Cancel property of your TreeViewCancelEventArgs parameter to false. For web controls see Vinay's answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜