I am working on a winform and on my UI there is a treeview, I found that the treenode will be highlighted even I did not click on the node by right mouse (eg, Node1 will be high
try this
void treeView1_MouseDown(object sender, MouseEventArgs e) { TreeViewHitTestInfo h = treeView1.HitTest(e.Location); if (h.Location != TreeViewHitTestLocations.Label && h.Location!= TreeViewHitTestLocations.None ) { treeView1.SelectedNode = null; } }