AddTreeItem(string nodeName, string category, TreeNode parentNode, ImageIconList imageIndex) { TreeNode node = new TreeNode(nodeName); node.Name = nodeName; node.Tag = category; // can be null node.ImageIndex = (int)imageIndex; node.SelectedImageIndex = (int)imageIndex; if (parentNode == null) { m_treeView.Nodes.Add(node); } else { parentNode.Nodes.Add(node); } return(node); }
/// <summary> /// This is the simple case of adding a root node to the tree or a simple Category-based node. /// Category and ParentNode can be null. /// </summary> /// <param name="nodeName">Text to display</param> /// <param name="category">Display string for the category</param> /// <param name="parentNode">Parent node to add to</param> /// <param name="imageIndex">Which image to display for the TreeNode</param> /// <returns>The newly added node</returns> private TreeNode AddTreeItem(string nodeName, string category, TreeNode parentNode, ImageIconList imageIndex) { TreeNode node = new TreeNode(nodeName); node.Name = nodeName; node.Tag = category; // can be null node.ImageIndex = (int)imageIndex; node.SelectedImageIndex = (int)imageIndex; if (parentNode == null) m_treeView.Nodes.Add(node); else parentNode.Nodes.Add(node); return node; }