'展开
For i = 1 To TreeView1.Nodes.Count - 1
    TreeView1.Nodes(i).Expanded = True
Next i得到焦点是nodeclick事件

解决方案 »

  1.   

    '        Tip:其实很多问题在以前的贴子里都有过很好的解答,我建议大家提问前先搜一下以前的贴子,会节约很多时间的.
    '
    '     Author:吴文智
    '       Date:2001-11-21
    'Description:要试用本例请在窗体中填加TreeView
    '            然后在代码窗体中粘贴如下代码
    '            Good luck!Option ExplicitPrivate Sub Form_Load()
        Dim nodEach As Node
        
        With Me.TreeView1
            .Nodes.Add , , "a", "a"
            .Nodes.Add "a", tvwChild, "b", "b"
            .Nodes.Add "a", tvwChild, "c", "c"
            .Nodes.Add , , "d", "d"
            .Nodes.Add "d", tvwChild, "e", "e"
            .Nodes.Add "d", tvwChild, "f", "f"
                
            For Each nodEach In .Nodes
                nodEach.Expanded = True
            Next
            
        End With
    End Sub
    Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
        'treeview控件的node得到焦点是NodeClick事件
        MsgBox Node.Text
    End Sub
      

  2.   

    node 是什么类型?后面又是nodes???不懂