Beispiel #1
0
        public override void Initialize()
        {
            base.Initialize();

            Dock = DockStyle.Fill;

            m_Tree      = new NTreeViewEx();
            m_Tree.Dock = DockStyle.Fill;

            NTreeViewExUC.AddTestNodes(m_Tree, 5, 2);

            m_Tree.ExpandAll();

            m_Tree.Parent = containerPanel;
        }
        internal static void AddTestNodes(NTreeViewEx tree, int siblingCount, int depth)
        {
            tree.Suspend();
            tree.Nodes.Clear();

            NTreeNode           node;
            int                 currDepth      = 0;
            NTreeNodeCollection currCollection = tree.Nodes;

            for (int i = 0; i < siblingCount; i++)
            {
                node      = new NTreeNode();
                node.Text = "Sample Tree Node " + i + "; Depth: " + currDepth;

                currDepth++;
                AddChildNodes(node.Nodes, siblingCount, ref currDepth, depth);
                currDepth--;

                currCollection.Add(node);
            }

            tree.Resume(true);
        }