Home All Groups Group Topic Archive Search About

get selected node from mouse right click

Author
3 Apr 2006 9:21 PM
iwdu15
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
--
-iwdu15

Author
3 Apr 2006 10:30 PM
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

Show quoteHide quote
"iwdu15" <jmmgoalsteratyahoodotcom> wrote in message
news:5F45722E-0C40-445B-A748-0AE9E4695CDC@microsoft.com...
> 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
> --
> -iwdu15
Author
4 Apr 2006 7:11 AM
Cor Ligthert [MVP]
Author
4 Apr 2006 10:52 PM
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

Show quoteHide quote
"iwdu15" <jmmgoalsteratyahoodotcom> wrote in message
news:5F45722E-0C40-445B-A748-0AE9E4695CDC@microsoft.com...
> 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
> --
> -iwdu15