Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim i As Integer
    
    If Button = 2 Then
        With TreeView1
            For i = 1 To .Nodes.Count
                If .Nodes(i).Selected then
                '或者if Nodes(i).key = "你要定位结点的key" then
                     '你要的操作
                End If
            Next i
        End With
    End IfEnd Sub

解决方案 »

  1.   

    用这三个函数可以处理消息循环
    Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal HWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
      

  2.   

    在treeview1_mouseup
    dim  nodx as node
    nodx=treeview1.HitTest(X, Y) if nodx is nothing then  exit subif button=2 then
    'nodx就是你要的node