ZForge.Controls.TreeViewAdv.Tree.NodeControls.NodeCheckBox.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)
        {
            Rectangle bounds = GetBounds(node, context);
            CheckState state = GetCheckState(node);
            if (Application.RenderWithVisualStyles)
            {
                VisualStyleRenderer renderer;
                if (state == CheckState.Indeterminate)
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.MixedNormal);
                else if (state == CheckState.Checked)
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.CheckedNormal);
                else
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.UncheckedNormal);
                renderer.DrawBackground(context.Graphics, new Rectangle(bounds.X, bounds.Y, ImageSize, ImageSize));
            }
            else
            {
                Image img;
                if (state == CheckState.Indeterminate)
                    img = _unknown;
                else if (state == CheckState.Checked)
                    img = _check;
                else
                    img = _uncheck;
                context.Graphics.DrawImage(img, bounds.Location);
            }
        }