public DynamicTreeNode(DynamicTreeNodeCollection collection, IDynamicTreeNodeDataProxy data)
 {
     ParentNodes = collection;
     nodes = new DynamicTreeNodeCollection(collection.View, this);
     ClientData = data;
     Render = true;
 }
        public DynamicTreeView()
            : base()
        {
            NodeSpacing = new Size(4, 4);
            SelectionRenderStyle = ArrowRenderStyle = DynamicTreeViewRenderStyle.Native;

            Nodes = new DynamicTreeNodeCollection(this);

            DoubleBuffered = true;
            ResizeRedraw = true;
            AutoScroll = true;

            VerticalScroll.SmallChange = Font.Height * 3;
            VerticalScroll.LargeChange = Font.Height * 10;
        }
 private void linkNodesChanged(DynamicTreeNodeCollection linkNodes)
 {
     if (Link.Nodes != linkNodes)
         return;
     linkNodesCache = null;
 }
 public DynamicTreeLinkNode(DynamicTreeNodeCollection collection, DynamicTreeNode link)
     : base(collection, null)
 {
     Link = link;
     nodesCache = new DynamicTreeNodeCollection(View, this);
 }
        protected virtual void PaintNodes(Graphics g, DynamicTreeNodeCollection nodes, ref int y)
        {
            foreach (DynamicTreeNode n in nodes.VisibleNodes)
            {
                bool draw = y + n.Bounds.Height > 0 && y < ClientSize.Height;

                int x = NodeSpacing.Width + n.Depth * arrowSize.Value.Width;

                if (draw && n.CanExpand)
                {
                    int f = (int)(Font.Size - 8.5);
                    Rectangle rect = new Rectangle(x, y - 2 + f, arrowSize.Value.Width, arrowSize.Value.Height);
                    n.ArrowBox = rect;
                    if (g != null)
                        DrawArrow(g, rect, n.Expanded, n == HighlightArrow);
                }
                x += arrowSize.Value.Width - 4;

                n.Position = new Point(x, y);

                if (n.Render && g != null)
                {
                    if (n == SelectedNode)
                    {
                        DrawSelection(g, Rectangle.Inflate(n.Bounds, -1, 2));
                    }

                    if (n == HighlightNode)
                    {
                        DrawHighlight(g, Rectangle.Inflate(n.Bounds, -1, 2));
                    }

                    if (SelectedNode != null && SelectedNode.HighlightWhenSelected(n.DataNode))
                    {
                        DrawSelection(g, Rectangle.Inflate(n.Bounds, -1, 2), Color.Yellow);
                    }

                    if (HighlightNode != null && HighlightNode.HighlightWhenSelected(n.DataNode))
                    {
                        DrawHighlight(g, Rectangle.Inflate(n.Bounds, -1, 2), Color.Yellow);
                    }

                    if (draw)
                        n.Draw(g);
                }
                //g.DrawRectangle(new Pen(Brushes.Gray, 1.0f), n.Bounds);
                y += n.Bounds.Height + NodeSpacing.Height;

                //if (n.Expanded)
                //    PaintNodes(g, n.Nodes, depth + 1, ref y);
            }
        }