1个回答
展开全部
在vb中,treeview控件响应nodeclick时间没有鼠标左右键参数,我想了一办法:
Private m_botton As Long'定义一个变量保存当前点下的是左键还是右键
Private Sub Form_Load()
With Me.TreeView1
.Nodes.Add , , "k1", "k1"
.Nodes.Add , , "k2", "k2"
End With
End Sub
'在mousedown中获取鼠标左右键信息(在 mouseup中都不行)
Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'先把上次选择的节点清除掉
set TreeView1.SelectedItem=nothing
m_botton = Button
End Sub
'弹出来看看
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
MsgBox m_botton
End Sub
Private m_botton As Long'定义一个变量保存当前点下的是左键还是右键
Private Sub Form_Load()
With Me.TreeView1
.Nodes.Add , , "k1", "k1"
.Nodes.Add , , "k2", "k2"
End With
End Sub
'在mousedown中获取鼠标左右键信息(在 mouseup中都不行)
Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'先把上次选择的节点清除掉
set TreeView1.SelectedItem=nothing
m_botton = Button
End Sub
'弹出来看看
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
MsgBox m_botton
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询