private static void SyncNodeCheckState_Child(TreeListNode node, CheckState check) { if (node != null) { node.DownRecursiveNode(n => n.CheckState = check); } }
/// <summary> /// 向下递归根据CheckState获取节点 /// <para>eg:tvCabTree.LHTree.GetDownRecursiveNodeListByCheckState(n => n.GetNodeType() == NodeType.Cab, new CheckState[2] { CheckState.Checked, CheckState.Indeterminate });</para> /// </summary> /// <param name="tree">TreeList</param> /// <param name="getFactory">委托</param> /// <param name="checkstate">CheckState</param> /// <returns>可能返回NULL;</returns> public static List <TreeListNode> GetDownRecursiveNodeListByCheckState(this TreeList tree, Predicate <TreeListNode> getFactory, CheckState[] checkstate) { if (tree != null) { TreeListNode _rootNode = tree.Nodes[0]; if (_rootNode != null) { List <TreeListNode> _checkedNodeList = new List <TreeListNode>(); _rootNode.DownRecursiveNode(n => { if (getFactory(n)) { if (checkstate.Contains <CheckState>(n.CheckState)) { _checkedNodeList.Add(n); } } }); return(_checkedNodeList); } } return(null); }