Raccoom.Windows.Forms.TreeViewFolderBrowserHelper.CreateTreeNode C# (CSharp) Method

CreateTreeNode() public method

Creates a tree node and add it to the TreeNodeCollection.
public CreateTreeNode ( string text, string path, bool addDummyNode, bool forceChecked, bool isSpecialFolder ) : TreeNodePath
text string The text displayed in the label of the tree node.
path string The path the node represents.
addDummyNode bool True to add + sign, otherwise no + sign appears.
forceChecked bool True to check node in each case, otherwise false to allow normal check against selected paths.
isSpecialFolder bool Specifies if this node is a special folder. Special folders do not request data from the attached data provider.
return TreeNodePath
        public virtual TreeNodePath CreateTreeNode(string text, string path, bool addDummyNode, bool forceChecked,
            bool isSpecialFolder)
        {
            TreeNodePath newNode = new TreeNodePath(text, isSpecialFolder);
              // path
              newNode.Path = path;
              //
              try
              {
            _treeView.SupressCheckEvent(true);
            //
            if (forceChecked)
            {
              newNode.Checked = true;
            }
            else
            {
              newNode.Checked = _treeView.SelectedDirectories.Contains(path);
            }
            _treeView.MarkNode(newNode);
              }
              catch (Exception e)
              {
            Debug.WriteLine(e.Message, _treeView.Name);
              }
              finally
              {
            _treeView.SupressCheckEvent(false);
              }
              //
              if (addDummyNode)
              {
            // add dummy node, otherwise there is no + sign
            newNode.AddDummyNode();
              }
              //
              return newNode;
        }

Usage Example

示例#1
0
        /// <summary>
        ///   Creates a new node and assigns a icon
        /// </summary>
        /// <param name = "helper"></param>
        /// <param name = "text"></param>
        /// <param name = "path"></param>
        /// <param name = "addDummyNode"></param>
        /// <param name = "forceChecked"></param>
        /// <returns></returns>
        protected virtual TreeNodePath CreateTreeNode(TreeViewFolderBrowserHelper helper, string text, string path,
                                                      bool addDummyNode, bool forceChecked, bool isSpecialFolder)
        {
            TreeNodePath node = helper.CreateTreeNode(text, path, addDummyNode, forceChecked, isSpecialFolder);

            try
            {
                SetIcon(helper.TreeView, node);
            }
            catch
            {
                node.ImageIndex         = -1;
                node.SelectedImageIndex = -1;
            }
            return(node);
        }
All Usage Examples Of Raccoom.Windows.Forms.TreeViewFolderBrowserHelper::CreateTreeNode