DevExpress獲得TreeList可視區域節點聚集的完成辦法。本站提示廣大學習愛好者:(DevExpress獲得TreeList可視區域節點聚集的完成辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是DevExpress獲得TreeList可視區域節點聚集的完成辦法正文
本文實例展現了DevExpress獲得TreeList可視區域節點聚集的完成辦法,是比擬有適用價值的技能。分享給年夜家供年夜家參考。詳細完成辦法以下:
症結代碼以下:
/// <summary> /// 獲得可視區域節點 /// </summary> /// <param name="treeList">TreeList</param> /// <param name="conditonHanlder">前提拜托</param> /// <returns>可視區域節點聚集</returns> public static List<TreeListNode> GetVisibleNodes(this TreeList treeList, Predicate<TreeListNode> conditonHanlder) { List<TreeListNode> _visibleNodes = new List<TreeListNode>(); RowsInfo _rowsInfo = treeList.ViewInfo.RowsInfo; foreach (RowInfo ri in _rowsInfo.Rows) { TreeListNode _curNode = ri.Node; if (conditonHanlder(_curNode)) { _visibleNodes.Add(_curNode); } } return _visibleNodes; } /// <summary> /// 獲得可視區域節點 /// </summary> /// <param name="treeList">TreeList</param> /// <returns>可視區域節點聚集</returns> public static List<TreeListNode> GetVisibleNodes(this TreeList treeList) { return GetVisibleNodes(treeList, n => 1 == 1); }
代碼應用辦法以下:
MessageBox.Show(tvwLamp.LHTree.GetVisibleNodes(n => n.GetNodeType() == NodeType.Cab).Count.ToString());
願望本文所述實例對年夜家C#法式設計能有所贊助!