刀具结构树
刀具类
9311系列
9311-011
9311-012
9311-033
9312系列
9312-035
9313系列
辅具类在(9311系列、9312系列、9313系列)和(9311-011.....)这两级弹出菜单不同的菜单,请问如何操作!
具体的我可能说不清楚,有可以的加我QQ434684189吧!谢谢大家呀!
刀具类
9311系列
9311-011
9311-012
9311-033
9312系列
9312-035
9313系列
辅具类在(9311系列、9312系列、9313系列)和(9311-011.....)这两级弹出菜单不同的菜单,请问如何操作!
具体的我可能说不清楚,有可以的加我QQ434684189吧!谢谢大家呀!
解决方案 »
- 关于将数据库中的数据写入txt文本文件的问题
- 一个很奇怪的IMAGE透明问题,请大家帮解决一下[很急,拜托拜托]
- 如何删除某一文件夹下的所有文件?
- “微软”和“联通”有仇!
- 方子 请进
- 求助!在win2000下怎样自定义打印机纸张??
- Excel中的下边的显示多个工作簿(sheet)的按钮是怎么做的?
- photoshop里的那些工具栏是怎样实现的,vb的工具栏怎样实现的,在线等待
- To:gameboy999(我心迷茫) 你的Winsock发送文件工程给我一个好吗?
- 谁能讲一讲 sql distribution 和sql merge 控件如何用?
- VB高手,请问以下代码为什么不能将以下txt文件中的12345678改成87654321,应该怎么改,谢谢您.
- Rich Text内容输出到word
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function CreatePopupMenu Lib "user32" () As Long
Private Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal sCaption As String) As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Long) As Long
Private Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Const MF_ENABLED = &H0&
Private Const MF_SEPARATOR = &H800&
Private Const MF_STRING = &H0&
Private Const TPM_RIGHTBUTTON = &H2&
Private Const TPM_LEFTALIGN = &H0&
Private Const TPM_NONOTIFY = &H80&
Private Const TPM_RETURNCMD = &H100&Private Sub Form_Load()
Me.TreeView1.Nodes.Add(, , "r", "中国").Expanded = True
Me.TreeView1.Nodes.Add("r", tvwChild, "r1", "四川").Expanded = True
Me.TreeView1.Nodes.Add("r1", tvwChild, "r11", "汶川").Expanded = True
Me.TreeView1.Nodes.Add("r1", tvwChild, "r12", "北川").Expanded = True
Me.TreeView1.Nodes.Add("r", tvwChild, "r2", "甘肃").Expanded = True
End SubPrivate Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim pos As POINTAPI
Dim nod As Node, child As Node
Dim hMenu As Long, i As Long, id As Long
If Button = 2 Then
Set nod = Me.TreeView1.HitTest(x, y) '获得当前鼠标右键按下时所在的结节
If nod Is Nothing Then Exit Sub
If nod.Children = 0 Then Exit Sub
GetCursorPos pos
hMenu = CreatePopupMenu()
Set child = nod.child
Do While Not child Is Nothing
AppendMenu hMenu, MF_STRING Or MF_ENABLED, i, child.Text
Set child = child.Next
i = i + 1
Loop
id = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON Or TPM_LEFTALIGN Or TPM_NONOTIFY Or TPM_RETURNCMD, _
pos.x, pos.y, 0, Me.hwnd, 0) '选中的菜单条目
'....在此处加入菜单选择后的代码
DestroyMenu hMenu
End If
End Sub
例如 9311系列 为一个系列 若我把它的key设为 Group1
9312系列 key Group1
9311-011 key Child1
9311-012 key Child2
9311-033 key Child3
Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 then
If TreeView1.SelectedItem Like "Group*" then '右键点时自动选中了目标节点
'弹出对应菜单
end if
If TreeView1.SelectedItem Like "Child*" then
'弹出对应菜单
end if
end if
end sub