get selected node from mouse right click

G

Guest

hi, the treeview only selects a tree node when clicked with the left mouse
button...how can i get it to select a node with the right mouse button?

thanks
 
V

Vijay

In the mousedown , you can use e.x and e.y along with HitTest method to get
the nodeclicked... I don't have the exact code in the pile I have here... I
found a sample from CodeProject to use.. you check the site out...

Vijay
 
V

Vijay

Here is how you do in version 1.1.. and 2003


If e.Button = MouseButtons.Right Then
Dim currNode As TreeNode
Dim ClickPoint As Point = New Point(e.X, e.Y)
currNode = TreeViewControl1.GetNodeAt(ClickPoint)
If currNode Is Nothing Then
Return
End If
If Not TypeOf currNode.Tag Is TreeTag Then
Return
End If
End If

VJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top