下列代码演示了如何遍历已选中的节点,以便于展开它们。 通过 TreeList.Selection 属性访问已选中的节点。

C#CopyCode image复制代码
for(int i = 0; i < treeList1.Selection.Count; i++) {
   treeList1.Selection[i].Expanded = true;
}
Visual BasicCopyCode image复制代码
Dim i As Integer
For i = 0 To TreeList1.Selection.Count - 1
   TreeList1.Selection(i).Expanded = True
Next i