TreeViewAdv是一款功能强大的树型控件,支持为节点添加CheckBox,支持为节点添加图片,支持按需加载数据,开发人员也可以自定义节点,支持滚动和分类排序,可以对节点进行拖拉操作,为节点设置提示信息以及菜单等,该产品包含在
Essential Studio for Windows Forms界面套包控件里,这篇文章主要介绍怎么对树型控件的节点进行全部选择,具体可以参考下面的代码:
// Checking for all the root nodes in the tree.
foreach (TreeNodeAdv node in this.treeViewAdv1.Root.Nodes)
{
this.treeViewAdv1.SelectedNodes.Add(node);
TreeNodeAdv lastNode = node.LastNode;
while (lastNode != null)
{
// The selection is extended to the last node of the tree.
this.treeViewAdv1.ExtendSelectionTo(lastNode);
lastNode = lastNode.LastNode;
}
}