VB6 Treeview的添加节点子节点、Treeview打开、Treeview关闭

前端之家收集整理的这篇文章主要介绍了VB6 Treeview的添加节点子节点、Treeview打开、Treeview关闭前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

===================VB6 Treeview的添加节点子节点、Treeview打开、Treeview关闭'在窗体上方一个Treeview,四个command Option Explicit Private Sub Command1_Click() Static i As Integer TreeView1.Nodes.Add,"Text" & i,"Text" & i TreeView1.Nodes("Text" & i).Selected = True TreeView1.SetFocus i = i + 1 End Sub Private Sub Command2_Click() Static i As Integer TreeView1.Nodes.Add TreeView1.SelectedItem.Key,tvwChild,"TestSub" & i,"TestSub" & i TreeView1.SetFocus i = i + 1 End Sub Private Sub Command3_Click() Dim i As Integer For i = 1 To TreeView1.Nodes.Count If TreeView1.Nodes(i).Expanded = False Then TreeView1.Nodes(i).Expanded = True End If Next End Sub Private Sub Command4_Click() Dim i As Integer For i = 1 To TreeView1.Nodes.Count If TreeView1.Nodes(i).Expanded = True Then TreeView1.Nodes(i).Expanded = False End If Next End Sub Private Sub Form_Load() TreeView1.LineStyle = tvwRootLines TreeView1.Indentation = 200 Command1.Caption = "添加节点" Command2.Caption = "添加子节点" Command3.Caption = "展开所有" Command4.Caption = "收缩所有" End Sub

猜你在找的VB相关文章