'Indentation属性 'MSDN的例子 '窗体上放一个treeview,然后放三个option钮(是数组)Private Sub Form_Load() ' Label OptionButton controls with Indentation choices. Option1(0).Caption = "250" Option1(1).Caption = "500" Option1(2).Caption = "1000" ' Select the first option, and set the indentation to 250 initially Option1(0).Value = True TreeView1.Indentation = 250 Dim nodX As Node Dim i As Integer Set nodX = TreeView1.Nodes.Add(, , , CStr(1)) ' Add first node. For i = 1 To 6 ' Add 6 nodes. Set nodX = TreeView1.Nodes.Add(i, tvwChild, , CStr(i + 1)) Next i nodX.EnsureVisible ' Makes sure all nodes are visible. Form1.Caption = "Indentation = " & TreeView1.Indentation End SubPrivate Sub Option1_Click(Index As Integer) ' Change Indentation with OptionButton value. TreeView1.Indentation = Val(Option1(Index).Caption) Form1.Caption = "Indentation = " & TreeView1.Indentation End Sub
'MSDN的例子
'窗体上放一个treeview,然后放三个option钮(是数组)Private Sub Form_Load()
' Label OptionButton controls with Indentation choices.
Option1(0).Caption = "250"
Option1(1).Caption = "500"
Option1(2).Caption = "1000" ' Select the first option, and set the indentation to 250 initially
Option1(0).Value = True
TreeView1.Indentation = 250 Dim nodX As Node
Dim i As Integer Set nodX = TreeView1.Nodes.Add(, , , CStr(1)) ' Add first node. For i = 1 To 6 ' Add 6 nodes.
Set nodX = TreeView1.Nodes.Add(i, tvwChild, , CStr(i + 1))
Next i nodX.EnsureVisible ' Makes sure all nodes are visible.
Form1.Caption = "Indentation = " & TreeView1.Indentation
End SubPrivate Sub Option1_Click(Index As Integer) ' Change Indentation with OptionButton value.
TreeView1.Indentation = Val(Option1(Index).Caption)
Form1.Caption = "Indentation = " & TreeView1.Indentation
End Sub