1 private void treeView1_MouseUp(object sender, MouseEventArgs e)
 2         {
 3              
 4             TreeNode selectnode = this.treeView1.GetNodeAt(e.Location);
 5             if (selectnode == null)
 6             {
 7                 this.treeView1.SelectedNode = null;
 8  
 9             }  
10  
11         }
12  
13         private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e)
14         {
15             if (e.Action == TreeViewAction.Unknown)
16                 e.Cancel = true;
17         }

 

欢迎关注微信公众号:大数据从业者