// Public members

        public override void PaintControl(GroupBox control, ControlPaintArgs e)
        {
            IRuleset ruleset = e.StyleSheet.GetRuleset(control);

            IRuleset textBackgroundRuleset = new Ruleset();

            textBackgroundRuleset.AddProperty(ruleset.BackgroundColor);

            SizeF textSize = e.Graphics.MeasureString(control.Text, control.Font);

            Rectangle clientRect         = control.ClientRectangle;
            Rectangle backgroundRect     = new Rectangle(clientRect.X, clientRect.Y + (int)textSize.Height / 2, clientRect.Width, clientRect.Height - (int)textSize.Height / 2);
            Rectangle textRect           = new Rectangle(clientRect.X + 6, clientRect.Y, (int)textSize.Width, (int)textSize.Height);
            Rectangle textBackgroundRect = new Rectangle(textRect.X, backgroundRect.Y, textRect.Width, textRect.Height - (int)textSize.Height / 2);

            e.Clear();

            e.StyleRenderer.PaintBackground(e.Graphics, backgroundRect, ruleset);
            e.StyleRenderer.PaintBorder(e.Graphics, backgroundRect, ruleset);

            e.StyleRenderer.PaintBackground(e.Graphics, textBackgroundRect, textBackgroundRuleset);
            e.StyleRenderer.PaintBorder(e.Graphics, textBackgroundRect, textBackgroundRuleset);

            e.StyleRenderer.PaintText(e.Graphics, textRect, ruleset, control.Text, control.Font, TextFormatFlags.Top);
        }
        // Public members

        public override void PaintControl(Control control, ControlPaintArgs e)
        {
            Rectangle clientRect = control.ClientRectangle;

            clientRect.Offset(-1, 1);

            Rectangle topButtonRect    = new Rectangle(clientRect.X, clientRect.Y, clientRect.Width, clientRect.Height / 2);
            Rectangle bottomButtonRect = new Rectangle(topButtonRect.X, clientRect.Y + clientRect.Height / 2, topButtonRect.Width, topButtonRect.Height);

            Rectangle topButtonClickRect    = topButtonRect;
            Rectangle bottomButtonClickRect = bottomButtonRect;

            topButtonClickRect.Offset(0, -1);
            bottomButtonClickRect.Offset(0, -1);

            e.Clear();

            e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

            PaintButton(e, topButtonRect, TriangleOrientation.Up, e.StyleSheet.GetRuleset(new ControlNode(control, topButtonClickRect)));
            PaintButton(e, bottomButtonRect, TriangleOrientation.Down, e.StyleSheet.GetRuleset(new ControlNode(control, bottomButtonClickRect)));
        }
        // 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();
        }