TreeView and right click select?
-
I have added a context menu to my TreeView, but when i use TreeView.SelectedNode it doesnt return the node that the user right clicked on only the node that was last left clicked. Is there anyway to get a TreeView to select the node the mouse is over on right click? Thanks Tim
-
I have added a context menu to my TreeView, but when i use TreeView.SelectedNode it doesnt return the node that the user right clicked on only the node that was last left clicked. Is there anyway to get a TreeView to select the node the mouse is over on right click? Thanks Tim
-
I have added a context menu to my TreeView, but when i use TreeView.SelectedNode it doesnt return the node that the user right clicked on only the node that was last left clicked. Is there anyway to get a TreeView to select the node the mouse is over on right click? Thanks Tim
Use the MouseUp Event for the TreeView and get the current mouse position. Then you can Use the TreeView.GetNodeAt(X,Y), here follows the code. The TreeView was called FolderTreeView! private void FolderTreeView_MouseUp (object sender ,System.Windows.Forms.MouseEventArgs e) {//MouseButton Released try { //Select the Node Under the Mouse Cursor as Current Node FolderTreeView.SelectedNode = FolderTreeView.GetNodeAt(e.X,e.Y); } } Leon v Wyk