我想要双击treeview的子nodes触发事件而不是单击,单击的我会了: Private Sub DTTreeView1_Nodeclick(ByVal Node As ComctlLib.Node) If DTTreeView1.Nodes(6).Selected Then LTWebBrowser1.Navigate ("http://bbs.cctvgame.com") End If End Sub
treeview有双击事件但是不是他要的效果.
Private Sub Form_Load() With TreeView1 .LineStyle = tvwTreeLines .PathSeparator = "\" .FullRowSelect = True .Style = tvwTreelinesPlusMinusText End With Dim Root As Node 'Add some items With TreeView1.Nodes Set Root = .Add(, , , "Top-level Node #1") .Add Root.Index, tvwChild, , "Child Node #1" .Add Root.Index, tvwChild, , "Child Node #2" .Add Root.Index, tvwChild, , "Child Node #3" Set Root = .Add(, , , "Top-level Node #2") .Add Root.Index, tvwChild, , "Child Node #1" .Add Root.Index, tvwChild, , "Child Node #2" .Add Root.Index, tvwChild, , "Child Node #3" Set Root = .Add(, , , "Top-level Node #3") .Add Root.Index, tvwChild, , "Child Node #1" .Add Root.Index, tvwChild, , "Child Node #2" .Add Root.Index, tvwChild, , "Child Node #3" Set Root = .Add(, , , "Top-level Node #4") .Add Root.Index, tvwChild, , "Child Node #1" .Add Root.Index, tvwChild, , "Child Node #2" .Add Root.Index, tvwChild, , "Child Node #3" End With End SubPrivate Sub TreeView1_DblClick() Dim nodex As Node Set nodex = TreeView1.SelectedItem 'SelectedItem为当前选中的节点
Private Sub DTTreeView1_Nodeclick(ByVal Node As ComctlLib.Node)
If DTTreeView1.Nodes(6).Selected Then
LTWebBrowser1.Navigate ("http://bbs.cctvgame.com")
End If
End Sub
With TreeView1
.LineStyle = tvwTreeLines
.PathSeparator = "\"
.FullRowSelect = True
.Style = tvwTreelinesPlusMinusText
End With
Dim Root As Node
'Add some items
With TreeView1.Nodes
Set Root = .Add(, , , "Top-level Node #1")
.Add Root.Index, tvwChild, , "Child Node #1"
.Add Root.Index, tvwChild, , "Child Node #2"
.Add Root.Index, tvwChild, , "Child Node #3"
Set Root = .Add(, , , "Top-level Node #2")
.Add Root.Index, tvwChild, , "Child Node #1"
.Add Root.Index, tvwChild, , "Child Node #2"
.Add Root.Index, tvwChild, , "Child Node #3"
Set Root = .Add(, , , "Top-level Node #3")
.Add Root.Index, tvwChild, , "Child Node #1"
.Add Root.Index, tvwChild, , "Child Node #2"
.Add Root.Index, tvwChild, , "Child Node #3"
Set Root = .Add(, , , "Top-level Node #4")
.Add Root.Index, tvwChild, , "Child Node #1"
.Add Root.Index, tvwChild, , "Child Node #2"
.Add Root.Index, tvwChild, , "Child Node #3"
End With
End SubPrivate Sub TreeView1_DblClick()
Dim nodex As Node
Set nodex = TreeView1.SelectedItem 'SelectedItem为当前选中的节点
MsgBox nodex.FullPath
End Sub
这句最有用。