/// <summary> /// Creates a tree node and add it to the <c>TreeNodeCollection</c>. /// </summary> /// <param name="parentCollection"><c>TreeNodeCollection</c> to which the new node will added.</param> /// <param name="parentNode">Parent node for the new created child node.</param> /// <param name="text">The text displayed in the label of the tree node.</param> /// <param name="path">The path the node represents.</param> /// <param name="addDummyNode">True to add + sign, otherwise no + sign appears.</param> /// <param name="forceChecked">True to check node in each case, otherwise false to allow normal check against selected paths.</param> /// <param name="isSpecialFolder">Specifies if this node is a special folder. Special folders do not request data from the attached data provider.</param> /// <returns>The newly created and added node</returns> public virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool addDummyNode, bool forceChecked, bool isSpecialFolder) { if (parentCollection == null) { throw new ArgumentNullException("parentCollection"); } // if (_treeView.InvokeRequired) { return(_treeView.Invoke(new CreateTreeNodeDelegate(CreateTreeNode), new object[] { parentNode, text, path, addDummyNode, forceChecked, isSpecialFolder }) as TreeNodePath); } // forceChecked = forceChecked || (TreeView.CheckBoxBehaviorMode == CheckBoxBehaviorMode.RecursiveChecked && (parentNode != null && parentNode.Checked)); // TreeNodePath childNode = CreateTreeNode(text, path, addDummyNode, forceChecked, isSpecialFolder); parentCollection.Add(childNode); return(childNode); }
/// <summary> /// Expands the tree node. /// </summary> /// <param name="parentNode">The Expand method expands the current TreeNode down to the next level of nodes.</param> public virtual void ExpandNode(System.Windows.Forms.TreeNode parentNode) { if (_treeView.InvokeRequired) { _treeView.Invoke(new ExpandNodeDelegate(ExpandNode), new object[] { parentNode }); return; } System.Diagnostics.Debug.Assert(parentNode != null); parentNode.Expand(); }