Exemplo n.º 1
0
        public override void PaintControl(RichTextBox control, ControlPaintArgs args)
        {
            INode    controlNode = new ControlNode(control);
            IRuleset ruleset     = args.StyleSheet.GetRuleset(controlNode);

            RenderUtilities.ApplyColorProperties(control, ruleset);

            Rectangle clientRect = control.ClientRectangle;
            Rectangle borderRect = new Rectangle(clientRect.X - 3, clientRect.Y - 3, clientRect.Width + 6, clientRect.Height + 6);

            ScrollBars visibleScrollbars = ControlUtilities.GetVisibleScrollBars(control);

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

            if (visibleScrollbars.HasFlag(ScrollBars.Horizontal))
            {
                borderRect = new Rectangle(borderRect.X, borderRect.Y, borderRect.Width, borderRect.Height + SystemInformation.HorizontalScrollBarHeight);
            }

            args.PaintBackground(borderRect);
            args.PaintBorder(borderRect);
        }
Exemplo n.º 2
0
        private void PaintGenericControl(ControlPaintArgs e)
        {
            IRuleset ruleset = e.StyleSheet.GetRuleset(new ControlNode(e.Control));

            RenderUtilities.ApplyColorProperties(e.Control, ruleset);

            e.PaintBackground();
            e.PaintBorder();
        }
        // Public members

        public override void PaintControl(ProgressBar control, ControlPaintArgs args)
        {
            args.PaintBackground();
            args.PaintBorder();

            args.ClipToBorder();

            PaintProgress(control, args);
        }
Exemplo n.º 4
0
        public override void PaintControl(PictureBox control, ControlPaintArgs args)
        {
            args.PaintBackground();

            if (control.Image != null)
            {
                args.Graphics.DrawImage(control.Image, new Rectangle(0, 0, control.Width, control.Height), (ImageSizeMode)control.SizeMode);
            }

            args.PaintBorder();
        }
Exemplo n.º 5
0
        // Public members

        public override void PaintControl(TabControl control, ControlPaintArgs e)
        {
            // Paint the background.

            e.PaintBackground();
            e.PaintBorder();

            // Paint the tabs.

            PaintTabs(control, e);
        }
Exemplo n.º 6
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 members

        public override void PaintControl(CheckBox control, ControlPaintArgs e)
        {
            e.PaintBackground();
            e.PaintBorder();

            PaintCheck(control, e);

            IRuleset ruleset = e.StyleSheet.GetRuleset(control);

            Rectangle clientRect = control.ClientRectangle;
            Rectangle drawRect   = new Rectangle(clientRect.X + CheckWidth + 3, clientRect.Y - 1, clientRect.Width, clientRect.Height);

            e.StyleRenderer.PaintText(e.Graphics, drawRect, ruleset, control.Text, control.Font, ControlUtilities.GetTextFormatFlags(control.TextAlign));
        }
        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(ComboBox control, ControlPaintArgs e)
        {
            IRuleset ruleset = e.StyleSheet.GetRuleset(control);

            RenderUtilities.ApplyColorProperties(control, ruleset);

            Rectangle clientRect = control.ClientRectangle;

            e.PaintBackground();

            // Match the foreground bounds of the default control.
            // The text is cut off behind the drop-down arrow.

            Rectangle textRect = new Rectangle(clientRect.X + 1, clientRect.Y, clientRect.Width - 21, clientRect.Height);

            e.PaintText(textRect);

            PaintDropDownArrow(control, e);

            e.PaintBorder();
        }
Exemplo n.º 10
0
        // Public members

        public override void PaintControl(Button control, ControlPaintArgs e)
        {
            TextFormatFlags textFormatFlags = ControlUtilities.GetTextFormatFlags(control.TextAlign);

            e.Clear();

            e.PaintBackground();

            if (control.Image != null)
            {
                const int horizontalPadding = 4;
                const int verticalPadding   = 4;

                Rectangle imageRect = new Rectangle(horizontalPadding, verticalPadding, control.Width - horizontalPadding * 2, control.Height - verticalPadding * 2);

                e.Graphics.DrawImage(control.Image, imageRect, control.ImageAlign);
            }

            e.PaintText(textFormatFlags);

            e.PaintBorder();
        }
Exemplo n.º 11
0
        // 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);
        }
Exemplo n.º 12
0
        // Public members

        public override void PaintControl(Label control, ControlPaintArgs e)
        {
            e.PaintBackground();
            e.PaintText(ControlUtilities.GetTextFormatFlags(control.TextAlign) | TextFormatFlags.WordBreak);
            e.PaintBorder();
        }