Double Click on TreeView

N

NotYetaNurd

Hi all,
I wanted to know if a node in tree view is double clicked,
I tried clicks property on MouseDown but it always returns 1.
any solutions for this problem


regards,
....
 
P

Palo Mraz

This worked for me:

1. Save the mouse coordinates from the last MouseUp event into a Form
member:

' This is your Form's member:
Private _MouseCoords As System.Drawing.Point
....
Private Sub TreeView1_MouseUp(...) Handles TreeView1.MouseUp
With _MouseCoords
.X = e.X
.Y = e.Y
End With
End Sub

2. Check if the coordinates are within the double-clicked node:

Private Sub TreeView1_DoubleClick(...) Handles TreeView1.DoubleClick
Dim Node As System.Windows.Forms.TreeNode =
TreeView1.GetNodeAt(_MouseCoords)
If (Not Node Is Nothing) AndAlso Node.Bounds.Contains(_MouseCoords) Then
MsgBox("Double:)")
End If
End Sub
 

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