BrightIdeasSoftware.TreeListView.TreeRenderer.Render C# (CSharp) Method

Render() public method

The real work of drawing the tree is done in this method
public Render ( System graphic, System rect ) : void
graphic System
rect System
return void
            public override void Render(System.Drawing.Graphics graphic, System.Drawing.Rectangle rect)
            {
                this.DrawBackground(graphic, rect);

                Branch br = this.Branch;

                Rectangle paddedRectangle = this.ApplyCellPadding(rect);

                Rectangle expandGlyphRectangle = paddedRectangle;
                expandGlyphRectangle.Offset((br.Level - 1) * PIXELS_PER_LEVEL, 0);
                expandGlyphRectangle.Width = PIXELS_PER_LEVEL;
                expandGlyphRectangle.Height = PIXELS_PER_LEVEL;
                expandGlyphRectangle.Y = this.AlignVertically(paddedRectangle, expandGlyphRectangle);
                int expandGlyphRectangleMidVertical = expandGlyphRectangle.Y + (expandGlyphRectangle.Height/2);

                if (this.IsShowLines)
                    this.DrawLines(graphic, rect, this.LinePen, br, expandGlyphRectangleMidVertical);

                if (br.CanExpand)
                    this.DrawExpansionGlyph(graphic, expandGlyphRectangle, br.IsExpanded);

                int indent = br.Level * PIXELS_PER_LEVEL;
                paddedRectangle.Offset(indent, 0);
                paddedRectangle.Width -= indent;

                this.DrawImageAndText(graphic, paddedRectangle);
            }