On a right mouse click, the DropHighlight property is set to the node that was clicked upon but only within the MouseUp event. It does not matter if FullRowSelect is true or false.
If you need to find the clicked upon node in the MouseDown event use this codeCode:Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbRightButton Then If Not TreeView1.DropHighlight Is Nothing Then TreeView1.DropHighlight.Selected = True End If End If End Sub
Code:Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim lngIdx As Long Dim oNode As Node If Button = vbRightButton Then Set oNode = TreeView1.HitTest(x, y) If oNode Is Nothing Then 'click did not occur directly on a node's text 'check if it may have occurred elsewhere along the node's row For lngIdx = 1 To TreeView1.Width Step 100 Set oNode = TreeView1.HitTest(lngIdx, y) If Not oNode Is Nothing Then oNode.Selected = True Exit For End If Next Else oNode.Selected = True End If End If End Sub




Reply With Quote