|
-
Jun 3rd, 2002, 11:54 AM
#1
Thread Starter
Lively Member
.NET TreeView and Mouse Clicks
In the TreeView's MouseUp event, how do I detect whether the user clicked the right or left mouse button?
I know that you can get whether the mouse did something by checking the action property on the TreeViewEventArgs object but I can't find anything on which button the user clicked on the mouse.
Thanks.
Last edited by ttingen; Jun 3rd, 2002 at 11:57 AM.
Um americano que fala portugues.
-
Jun 3rd, 2002, 11:57 AM
#2
Code:
Private Sub TreeView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseUp
Dim mySelectedNode As TreeNode
mySelectedNode = TreeView1.GetNodeAt(e.X, e.Y)
If e.Button = MouseButtons.Right Then
'do stuff
ElseIf e.Button = MouseButtons.Left Then
'do stuff
ElseIf e.Button = MouseButtons.Middle Then
'do stuff etc
End If
End Sub
-
Jun 3rd, 2002, 12:01 PM
#3
Thread Starter
Lively Member
that was quick.
I thought the event was restricted to the TreeViewEventArgs object but I guess event handlers just have to have an object that's derived from EventArgs.
thanks again.
Um americano que fala portugues.
-
Jun 3rd, 2002, 12:04 PM
#4
I think itdepends on the Event..such as with MouseUp, I believe you can use EventArgs, MouseEsventArg, or the TreeViewEventArgs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|