예제 #1
0
        internal static void AddRoot(TreeView tv, Control mainControl)
        {
            var nrd = new NewRootDialog {
                StartPosition = FormStartPosition.CenterParent
            };

            if (nrd.ShowDialog(mainControl) == DialogResult.OK)
            {
                var rootNode = new TreeNode(nrd.RootName)
                {
                    ImageIndex = 0, SelectedImageIndex = 0
                };

                tv.Nodes.Add(rootNode);

                tv.TreeViewNodeSorter = new NodeSorter();
                tv.Sort();
            }
        }
예제 #2
0
        /// <summary>
        /// Create a new root in the treeview
        /// </summary>
        public void CreateRoot()
        {
            var nrd = new NewRootDialog {
                StartPosition = FormStartPosition.CenterParent
            };

            if (nrd.ShowDialog(ParentForm) == DialogResult.OK)
            {
                var rootNode = new TreeNode(nrd.RootName)
                {
                    ImageIndex = 14, SelectedImageIndex = 14
                };

                tv.Nodes.Add(rootNode);

                tv.TreeViewNodeSorter = new NodeSorter();
                tv.Sort();
            }
        }