Treeview 问题!!!!!
以前没有用过VB,现在要用VB 做个控件,有个父节点AA,下面有两个子节点BB,CC。右击这两个子节点时弹出一个菜单,菜单中有:“可编辑”,“可选择”两个选项,时间比较急,请各位给点简要的代码,谢谢了。
[解决办法]
代码就没有,只说一下大概方法吧
先做一个菜单,隐藏的那种弹出菜单
然后在此子节点的mouse_click事件那里触发,显示出菜单.
[解决办法]
Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim nodX As Node
If Button = vbRightButton Then
Set nodX = TreeView1.HitTest(x, y)
If Not nodX Is Nothing Then
If Not nodX.Parent Is Nothing Then
PopupMenu yourmenu
End If
End If
End If
End Sub
[解决办法]
http://download.csdn.net/source/183738
这里有一个就是Treeview点右件弹出菜单“重命名”
代码很简单不像楼上那么复杂,我的就这一句
选择右键一样,根本不用什么hit
Private Sub TreeViewFolder_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu mMenuFolder
End Sub
右边是ListView和资源管理器一样