ZForge.Controls.TreeViewAdv.Tree.NodeControls.BaseTextControl.Draw C# (CSharp) Method

Draw() public method

public Draw ( TreeNodeAdv node, DrawContext context ) : void
node TreeNodeAdv
context DrawContext
return void
        public override void Draw(TreeNodeAdv node, DrawContext context)
        {
            if (context.CurrentEditorOwner == this && node == Parent.CurrentNode)
                return;

            PerformanceAnalyzer.Start("BaseTextControl.Draw");
            string label = GetLabel(node);
            Rectangle bounds = GetBounds(node, context);
            Rectangle focusRect = new Rectangle(bounds.X, context.Bounds.Y,
                bounds.Width, context.Bounds.Height);

            Brush backgroundBrush;
            Color textColor;
            Font font;
            CreateBrushes(node, context, label, out backgroundBrush, out textColor, out font, ref label);

            if (backgroundBrush != null)
                context.Graphics.FillRectangle(backgroundBrush, focusRect);
            if (context.DrawFocus)
            {
                focusRect.Width--;
                focusRect.Height--;
                if (context.DrawSelection == DrawSelectionMode.None)
                    _focusPen.Color = SystemColors.ControlText;
                else
                    _focusPen.Color = SystemColors.InactiveCaption;
                context.Graphics.DrawRectangle(_focusPen, focusRect);
            }
            if (UseCompatibleTextRendering)
                TextRenderer.DrawText(context.Graphics, label, font, bounds, textColor, _formatFlags);
            else
                context.Graphics.DrawString(label, font, GetFrush(textColor), bounds, _format);
            PerformanceAnalyzer.Finish("BaseTextControl.Draw");
        }