Beispiel #1
0
        // Protected members

        protected virtual void PaintBackground(TreeView control, ControlPaintArgs args)
        {
            IRuleset  ruleset    = args.StyleSheet.GetRuleset(control);
            Rectangle borderRect = RenderUtilities.GetOuterBorderRectangle(control, ruleset);

            if (ruleset.BackgroundColor.HasValue() && ruleset.BackgroundColor.Value != control.BackColor)
            {
                control.BackColor = ruleset.BackgroundColor.Value;
            }

            args.PaintBackground(borderRect);
            args.PaintBorder(borderRect);
        }
        public override void PaintControl(DataGridView control, ControlPaintArgs args)
        {
            // Draw the background/border of the control.

            IRuleset  ruleset    = args.StyleSheet.GetRuleset(control);
            Rectangle borderRect = RenderUtilities.GetOuterBorderRectangle(control, ruleset);

            if (ruleset.BackgroundColor.HasValue() && ruleset.BackgroundColor.Value != control.BackColor)
            {
                control.BackgroundColor = ruleset.BackgroundColor.Value;
            }

            args.PaintBackground(borderRect);
            args.PaintBorder(borderRect);
        }
        // Public members

        public override void PaintControl(ListBox control, ControlPaintArgs e)
        {
            Rectangle borderRect = RenderUtilities.GetOuterBorderRectangle(control, e.StyleSheet.GetRuleset(control));

            if (ControlUtilities.GetVisibleScrollBars(control).HasFlag(ScrollBars.Vertical))
            {
                borderRect = new Rectangle(borderRect.X, borderRect.Y, borderRect.Width + SystemInformation.VerticalScrollBarWidth, borderRect.Height);
            }

            e.PaintBackground();

            if (!e.ParentDraw)
            {
                GraphicsState graphicsState = e.Graphics.Save();

                e.ClipToBorder(borderRect);

                PaintItems(control, e);

                e.Graphics.Restore(graphicsState);
            }

            e.PaintBorder(borderRect);
        }