Double Click on TreeView

  • Thread starter Thread starter NotYetaNurd
  • Start date Start date
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,
....
 
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
 
Back
Top