啊,眼花了,一直看成了listview
这个要使用递归了
函数getchild
Dim node As WinForm.TreeNode = args(0)
If node.Nodes.Count = 0 OrElse node.IsExpanded = False Then
Return 0
Else
Dim sum As Integer = 0
For Each n As WinForm.TreeNode In node.Nodes
sum += Functions.Execute("getchild",n)
Next
Return node.Nodes.Count + sum
End If
调用
Dim trv As WinForm.TreeView = Forms("窗口1").Controls("TreeView1")
Output.Show(trv.ItemHeight)
Dim sum As Integer = 0
For Each n As WinForm.TreeNode In trv.Nodes
sum += Functions.Execute("getchild",n)
Next
Dim 行数 As Integer = trv.Nodes.Count + sum
Output.Show(行数)