Dim node As WinForm.TreeNode = Args(0)
Dim ctl = Args(1)
Dim lst As new List(of String)
Dim dict As new Dictionary(of String, WinForm.Control)
For Each c As object In ctl.Children
If Typeof c Is WinForm.SplitContainer Then
If c.panel1.Children.Count > 0 Then Functions.Execute("AddChild",node,c.panel1)
If c.panel2.Children.Count > 0 Then Functions.Execute("AddChild",node,c.panel2)
Else
lst.add(c.name)
dict.Add(c.name,c)
End If
Next
Dim arr = lst.ToArray
Array.Sort(arr)
For i As Integer = 0 To lst.Count - 1
Dim n = node.nodes.add(arr(i))
Dim c1 = dict(arr(i))
If Typeof c1 Is WinForm.Panel OrElse Typeof c1 Is WinForm.GroupBox Then
If c1.Children.Count > 0 Then Functions.Execute("AddChild",n,c1)
End If
Next
[此贴子已经被作者于2016/10/17 21:45:37编辑过]