TreeViewAdv控件如何选中树型中的所有节点

作者:控件中国网   出处:控件中国网   2016-02-29 10:32:52   阅读:5

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;
 
}                        
 
}
 
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat