是有MouseDown事件的,你再看看 Private Sub tvwData_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) if Button=vbLeftButton Then End If If Button=vbRightBotton Then End If End Sub
to lilaclone(~~阿九~~) 我说的是节点点击的左右点击事件,而不是整个树控件的左右点击事件.请指教!!
Private Sub tvwData_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) '鼠标弹起时,并返回当前节点,并判断单击左键还是右键。根据左右键不同调用不同处理程序 Dim nodeX As Node
'返回你说点击的Node对象 Set nod = tvwData.HitTest(x, y) '没有节点,进入错误处理部分 On Error GoTo EmptyNode
'设置你所点击的Node对象被选中 nod.Selected = True '检测鼠标的点击 If Button = vbRightButton Then '右键 '写入你的处理代码 ElseIf Button = vbLeftButton Then '左键 '写入你的处理代码 Endif
Private Sub tvwData_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
if Button=vbLeftButton Then
End If
If Button=vbRightBotton Then
End If
End Sub
我说的是节点点击的左右点击事件,而不是整个树控件的左右点击事件.请指教!!
'鼠标弹起时,并返回当前节点,并判断单击左键还是右键。根据左右键不同调用不同处理程序 Dim nodeX As Node
'返回你说点击的Node对象
Set nod = tvwData.HitTest(x, y) '没有节点,进入错误处理部分
On Error GoTo EmptyNode
'设置你所点击的Node对象被选中
nod.Selected = True '检测鼠标的点击
If Button = vbRightButton Then '右键
'写入你的处理代码
ElseIf Button = vbLeftButton Then '左键
'写入你的处理代码
Endif
Exit SubEmptyNode:
'错误处理代码
End Sub