protected override void OnPaint(PaintEventArgs e)
        {
            Color foreColor = MetroPaint.ForeColor.Button.Press(Theme);
            Color backColor = MetroPaint.GetStyleColor(Style);

            // Apply button shading
            if (isHovered && !isPressed && Enabled)
            {
                backColor = ControlPaint.Light(backColor, float.Parse("0.25"));
            }
            else if (isHovered && isPressed && Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Press(Theme);
                backColor = MetroPaint.GetStyleColor(Style);
            }
            else if (!Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Disabled(Theme);
                backColor = MetroPaint.BackColor.Button.Disabled(Theme);
            }
            else
            {
                foreColor = MetroPaint.ForeColor.Button.Press(Theme);
            }

            e.Graphics.Clear(backColor);
            Font buttonFont = MetroFonts.Button(MetroButtonSize.Small, MetroButtonWeight.Bold);

            TextRenderer.DrawText(e.Graphics, Text, buttonFont, ClientRectangle, foreColor, backColor,
                                  TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis
                                  );
        }
Example #2
0
 private void settheme()
 {
     this.BackColor  = MetroPaint.BackColor.Form(Theme);
     this.ForeColor  = MetroPaint.ForeColor.Button.Normal(Theme);
     this.RenderMode = ToolStripRenderMode.Professional;
     this.Renderer   = new MetroToolStripProfessionalRenderer(Theme, Style);
     //todo: figure out if this is how you are supposed to use the theme defined font
     this.Font = MetroFonts.Button(MetroButtonSize.Medium, MetroButtonWeight.Light);
 }
Example #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Color backColor, borderColor, foreColor;

            if (isHovered && !isPressed && Enabled)
            {
                backColor   = MetroPaint.BackColor.Button.Hover(Theme);
                borderColor = MetroPaint.BorderColor.Button.Hover(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Hover(Theme);
            }
            else if (isHovered && isPressed && Enabled)
            {
                backColor   = MetroPaint.BackColor.Button.Press(Theme);
                borderColor = MetroPaint.BorderColor.Button.Press(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Press(Theme);
            }
            else if (!Enabled)
            {
                backColor   = MetroPaint.BackColor.Button.Disabled(Theme);
                borderColor = MetroPaint.BorderColor.Button.Disabled(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Disabled(Theme);
            }
            else
            {
                backColor   = MetroPaint.BackColor.Button.Normal(Theme);
                borderColor = MetroPaint.BorderColor.Button.Normal(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Normal(Theme);
            }

            e.Graphics.Clear(backColor);

            using (Pen p = new Pen(borderColor))
            {
                Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                e.Graphics.DrawRectangle(p, borderRect);
            }

            if (Highlight && !isHovered && !isPressed && Enabled)
            {
                using (Pen p = MetroPaint.GetStylePen(Style))
                {
                    Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                    e.Graphics.DrawRectangle(p, borderRect);
                    borderRect = new Rectangle(1, 1, Width - 3, Height - 3);
                    e.Graphics.DrawRectangle(p, borderRect);
                }
            }

            TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight), ClientRectangle, foreColor, backColor, MetroPaint.GetTextFormatFlags(TextAlign));

            if (false && isFocused)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, ClientRectangle);
            }
        }
        protected virtual void OnPaintForeground(PaintEventArgs e)
        {
            Color color;
            Color foreColor;

            if (this.isHovered && !this.isPressed && base.Enabled)
            {
                color     = MetroPaint.BorderColor.Button.Hover(this.Theme);
                foreColor = MetroPaint.ForeColor.Button.Hover(this.Theme);
            }
            else if (this.isHovered && this.isPressed && base.Enabled)
            {
                color     = MetroPaint.BorderColor.Button.Press(this.Theme);
                foreColor = MetroPaint.ForeColor.Button.Press(this.Theme);
            }
            else if (base.Enabled)
            {
                color = MetroPaint.BorderColor.Button.Normal(this.Theme);
                if (!this.useCustomForeColor)
                {
                    foreColor = (!this.useStyleColors ? MetroPaint.ForeColor.Button.Normal(this.Theme) : MetroPaint.GetStyleColor(this.Style));
                }
                else
                {
                    foreColor = this.ForeColor;
                }
            }
            else
            {
                color     = MetroPaint.BorderColor.Button.Disabled(this.Theme);
                foreColor = MetroPaint.ForeColor.Button.Disabled(this.Theme);
            }
            using (Pen pen = new Pen(color))
            {
                Rectangle rectangle = new Rectangle(0, 0, base.Width - 1, base.Height - 1);
                e.Graphics.DrawRectangle(pen, rectangle);
            }
            if (this.Highlight && !this.isHovered && !this.isPressed && base.Enabled)
            {
                using (Pen stylePen = MetroPaint.GetStylePen(this.Style))
                {
                    Rectangle rectangle1 = new Rectangle(0, 0, base.Width - 1, base.Height - 1);
                    e.Graphics.DrawRectangle(stylePen, rectangle1);
                    rectangle1 = new Rectangle(1, 1, base.Width - 3, base.Height - 3);
                    e.Graphics.DrawRectangle(stylePen, rectangle1);
                }
            }
            TextRenderer.DrawText(e.Graphics, this.Text, MetroFonts.Button(this.metroButtonSize, this.metroButtonWeight), base.ClientRectangle, foreColor, MetroPaint.GetTextFormatFlags(this.TextAlign));
            this.OnCustomPaintForeground(new MetroPaintEventArgs(Color.Empty, foreColor, e.Graphics));
            if (this.displayFocusRectangle && this.isFocused)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, base.ClientRectangle);
            }
        }
Example #5
0
        public MetroButtonStyled()
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            UpdateStyles();

            this.DoubleBuffered = true;

            //set font
            this.Font = MetroFonts.Button(metroButtonSize, metroButtonWeight);
        }
Example #6
0
        private void InitColors()
        {
            //Set Colors & Fonts
            base.Font         = MetroFonts.Button(metroButtonSize, metroButtonWeight);
            tBorder           = MetroPaint.BorderColor.Button.Normal(Theme);
            tBottomColorBegin = MetroPaint.BackColor.Button.Normal(Theme);
            tBottomColorEnd   = MetroPaint.BackColor.Button.Normal2(Theme);
            Textcol           = MetroPaint.ForeColor.Button.Normal(Theme);
            controlFont       = MetroFonts.Button(metroButtonSize, metroButtonWeight);

            this.Font = MetroFonts.Button(metroButtonSize, metroButtonWeight);

            Invalidate();
            Update();
        }
Example #7
0
        public virtual void AddButton(string name, string text, DialogResult dr)
        {
            var button = new Button();

            button.BackColor               = ThemeColor;
            button.FlatStyle               = FlatStyle.Flat;
            button.Font                    = MetroFonts.Button(MetroButtonSize.Medium, MetroButtonWeight.Regular);
            button.Name                    = name;
            button.Size                    = new Size(75, 28);
            button.TabIndex                = 0;
            button.Text                    = text;
            button.DialogResult            = dr;
            button.UseVisualStyleBackColor = false;
            this.buttonsPanel.Controls.Add(button);
            this.buttons.Add(button);
        }
Example #8
0
        protected override void OnPaintForeground(PaintEventArgs e)
        {
            Color foreColor = Color.Empty;

            if (isHovered && !isPressed && Enabled)
            {
                foreColor = BaseAntButton.ChangeColor(MetroPaint.GetStyleColor(Style), 0.2f);
            }
            else if (isHovered && isPressed && Enabled)
            {
                foreColor = BaseAntButton.ChangeColor(MetroPaint.GetStyleColor(Style), -0.2f);
            }
            else if (!Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Disabled(Theme);
            }

            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight), ClientRectangle, foreColor, MetroPaint.GetTextFormatFlags(TextAlign));

            OnCustomPaintForeground(new MetroPaintEventArgs(Color.Empty, foreColor, e.Graphics));
        }
Example #9
0
            protected override void OnPaint(PaintEventArgs e)
            {
                Color backColor, foreColor;

                MetroThemeStyle _Theme = Theme;
                MetroColorStyle _Style = Style;

                if (Parent != null)
                {
                    if (Parent is IMetroForm)
                    {
                        _Theme    = ((IMetroForm)Parent).Theme;
                        _Style    = ((IMetroForm)Parent).Style;
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                    else if (Parent is IMetroControl)
                    {
                        _Theme    = ((IMetroControl)Parent).Theme;
                        _Style    = ((IMetroControl)Parent).Style;
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                    else
                    {
                        foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                        backColor = MetroPaint.GetStyleColor(_Style);
                    }
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                    backColor = MetroPaint.BackColor.Form(_Theme);
                }

                if (isHovered && !isPressed && Enabled)
                {
                    int _r = backColor.R;
                    int _g = backColor.G;
                    int _b = backColor.B;

                    backColor = ControlPaint.Light(backColor, 0.25f);
                }
                else if (isHovered && isPressed && Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                    backColor = MetroPaint.GetStyleColor(_Style);
                }
                else if (!Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Disabled(_Theme);
                    backColor = MetroPaint.BackColor.Button.Disabled(_Theme);
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                }

                e.Graphics.Clear(backColor);
                Font buttonFont = MetroFonts.Button(MetroButtonSize.Small, MetroButtonWeight.Bold);

                TextRenderer.DrawText(e.Graphics, Text, buttonFont, ClientRectangle, foreColor, backColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis);

                DrawIcon(e.Graphics);
            }
        protected virtual void OnPaintForeground(PaintEventArgs e)
        {
            Color borderColor, foreColor;

            if (isHovered && !isPressed && Enabled)
            {
                borderColor = MetroPaint.BorderColor.ButtonSuccess.Hover(Theme);
                foreColor   = MetroPaint.ForeColor.ButtonSuccess.Hover(Theme);
            }
            else if (isHovered && isPressed && Enabled)
            {
                borderColor = MetroPaint.BorderColor.ButtonSuccess.Press(Theme);
                foreColor   = MetroPaint.ForeColor.ButtonSuccess.Press(Theme);
            }
            else if (!Enabled)
            {
                borderColor = MetroPaint.BorderColor.ButtonSuccess.Disabled(Theme);
                foreColor   = MetroPaint.ForeColor.ButtonSuccess.Disabled(Theme);
            }
            else
            {
                borderColor = MetroPaint.BorderColor.ButtonSuccess.Normal(Theme);
                if (useCustomForeColor)
                {
                    foreColor = ForeColor;
                }
                else if (useStyleColors)
                {
                    foreColor = MetroPaint.GetStyleColor(Style);
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.ButtonSuccess.Normal(Theme);
                }
            }

            using (Pen p = new Pen(borderColor))
            {
                Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                e.Graphics.DrawRectangle(p, borderRect);
            }

            if (Highlight && !isHovered && !isPressed && Enabled)
            {
                using (Pen p = MetroPaint.GetStylePen(Style))
                {
                    Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                    e.Graphics.DrawRectangle(p, borderRect);
                    borderRect = new Rectangle(1, 1, Width - 3, Height - 3);
                    e.Graphics.DrawRectangle(p, borderRect);
                }
            }

            TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight), ClientRectangle, foreColor, MetroPaint.GetTextFormatFlags(TextAlign));

            OnCustomPaintForeground(new MetroPaintEventArgs(Color.Empty, foreColor, e.Graphics));

            if (displayFocusRectangle && isFocused)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, ClientRectangle);
            }
        }
        protected override void OnPaintForeground(PaintEventArgs e)
        {
            try
            {
                //base.OnPaintForeground(e);
                Color foreColor = Color.Empty;

                if (isHovered && !isPressed && Enabled)
                {
                    foreColor = BaseAntButton.ChangeColor(MetroPaint.GetStyleColor(Style), 0.2f);
                }
                else if (isHovered && isPressed && Enabled)
                {
                    foreColor = BaseAntButton.ChangeColor(MetroPaint.GetStyleColor(Style), -0.2f);
                }
                else if (!Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Disabled(Theme);
                }
                else if (Enabled)
                {
                    foreColor = MetroPaint.ForeColor.Button.Disabled(Theme);
                }
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

                if (AntIcon.Equals(AntButtonIcon.None))
                {
                    TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight),
                                          ClientRectangle
                                          , foreColor, MetroPaint.GetTextFormatFlags(TextAlign));
                }
                else
                {
                    int iconX = 0, iconY = 0, iconSize = 20, textLeftPadding = 0;

                    if (AntSize.Equals(AntButtonSize.Large))
                    {
                        iconX           = (int)IconLoaction.LargeIconX;
                        iconY           = (int)IconLoaction.LargeIconY;
                        iconSize        = (int)IconLoaction.LargeSize;
                        textLeftPadding = 20;
                    }
                    else if (AntSize.Equals(AntButtonSize.Default))
                    {
                        iconX           = (int)IconLoaction.DefaultIconX;
                        iconY           = (int)IconLoaction.DefaultIconY;
                        iconSize        = (int)IconLoaction.DefaultSize;
                        textLeftPadding = 20;
                    }
                    else if (AntSize.Equals(AntButtonSize.Small))
                    {
                        iconX           = (int)IconLoaction.SmallIconX;
                        iconY           = (int)IconLoaction.SmallIconY;
                        iconSize        = (int)IconLoaction.SmallISize;
                        textLeftPadding = 20;
                    }
                    using (Brush brush = new SolidBrush(foreColor))
                    {
                        var rec = BaseAntButton.DrawRoundRect(0, 0, Width - 1, Height - 1, AntShape.Equals(AntButtonShape.Circle) ? (int)AntSize : 10);
                        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

                        e.Graphics.DrawString(
                            Icon.Style[AntIcon],
                            UseMemoryFont(iconSize),
                            brush, new RectangleF()
                        {
                            X = iconX, Y = iconY, Width = (int)AntSize, Height = (int)AntSize
                        });
                    }
                    TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight),
                                          new Rectangle {
                        X = textLeftPadding, Y = ClientRectangle.Y, Width = ClientRectangle.Width - textLeftPadding, Height = ClientRectangle.Height
                    }

                                          , foreColor, MetroPaint.GetTextFormatFlags(TextAlign));
                }
            }
            catch (Exception)
            {
                Invalidate();
            }
        }
        //public MetroFormButton()
        //{
        //    SetStyle(ControlStyles.AllPaintingInWmPaint |
        //             ControlStyles.OptimizedDoubleBuffer |
        //             ControlStyles.ResizeRedraw |
        //             ControlStyles.UserPaint, true);
        //}

        #endregion

        #region Paint Methods

        protected override void OnPaint(PaintEventArgs e)
        {
            Color backColor, foreColor;

            MetroThemeStyle _Theme = Theme;
            MetroColorStyle _Style = Style;

            if (Parent != null)
            {
                if (Parent is IMetroForm)
                {
                    _Theme    = ((IMetroForm)Parent).Theme;
                    _Style    = ((IMetroForm)Parent).Style;
                    backColor = MetroPaint.BackColor.Form(_Theme);
                }
                else if (Parent is IMetroControl)
                {
                    _Theme    = ((IMetroControl)Parent).Theme;
                    _Style    = ((IMetroControl)Parent).Style;
                    backColor = MetroPaint.BackColor.Form(_Theme);
                }
                else
                {
                    backColor = Parent.BackColor;
                }
            }
            else
            {
                backColor = MetroPaint.BackColor.Form(_Theme);
            }

            if (isHovered && !isPressed && Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Normal(_Theme);
                backColor = MetroPaint.BackColor.Button.Normal(_Theme);
            }
            else if (isHovered && isPressed && Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Press(_Theme);
                backColor = MetroPaint.GetStyleColor(_Style);
            }
            else if (!Enabled)
            {
                foreColor = MetroPaint.ForeColor.Button.Disabled(_Theme);
                backColor = MetroPaint.BackColor.Button.Disabled(_Theme);
            }
            else
            {
                foreColor = MetroPaint.ForeColor.Button.Normal(_Theme);
            }

            e.Graphics.Clear(backColor);
            //Font buttonFont = new Font("Webdings", 9.25f);
            TextFormatFlags _firstflag  = TextFormatFlags.HorizontalCenter;
            TextFormatFlags _secondflag = TextFormatFlags.VerticalCenter;

            switch (TextAlign)
            {
            case ContentAlignment.BottomCenter:
                _secondflag = TextFormatFlags.Bottom;
                break;

            case ContentAlignment.BottomLeft:
                _firstflag  = TextFormatFlags.Left;
                _secondflag = TextFormatFlags.Bottom;
                break;

            case ContentAlignment.BottomRight:
                _firstflag  = TextFormatFlags.Right;
                _secondflag = TextFormatFlags.Bottom;
                break;

            case ContentAlignment.MiddleLeft:
                _firstflag = TextFormatFlags.Left;
                break;

            case ContentAlignment.MiddleRight:
                _firstflag = TextFormatFlags.Right;
                break;

            case ContentAlignment.TopCenter:
                _secondflag = TextFormatFlags.Top;
                break;

            case ContentAlignment.TopLeft:
                _firstflag  = TextFormatFlags.Left;
                _secondflag = TextFormatFlags.Top;
                break;

            case ContentAlignment.TopRight:
                _firstflag  = TextFormatFlags.Right;
                _secondflag = TextFormatFlags.Top;
                break;
            }

            TextRenderer.DrawText(e.Graphics, Text, _customfont ? MetroFonts.Button(metroButtonSize, metroButtonWeight) : Font, ClientRectangle, foreColor, backColor, _firstflag | _secondflag | TextFormatFlags.EndEllipsis);

            DrawIcon(e.Graphics);
        }
        protected virtual void OnPaintForeground(PaintEventArgs e)
        {
            Color borderColor, foreColor;

            if (isHovered && !isPressed && Enabled)
            {
                borderColor = Color.Transparent;// MetroPaint.BorderColor.Button.Hover(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Hover(Theme);
            }
            else if (isHovered && isPressed && Enabled)
            {
                borderColor = Color.Transparent;// MetroPaint.BorderColor.Button.Press(Theme);
                foreColor   = MetroPaint.ForeColor.Button.Press(Theme);
            }
            else if (!Enabled)
            {
                borderColor = Color.Transparent;             // MetroPaint.BorderColor.Button.Disabled(Theme);
                foreColor   = Color.FromArgb(137, 133, 132); //MetroPaint.ForeColor.Button.Disabled(Theme);
            }
            else
            {
                if (IsShowBorder)
                {
                    borderColor = Color.FromArgb(235, 128, 4);
                }
                else
                {
                    borderColor = Color.Transparent;//MetroPaint.BorderColor.Button.Normal(Theme);
                }

                if (useCustomForeColor)
                {
                    foreColor = ForeColor;
                }
                else if (useStyleColors)
                {
                    foreColor = MetroPaint.GetStyleColor(Style);
                }
                else
                {
                    foreColor = MetroPaint.ForeColor.Button.Normal(Theme);
                }
            }

            using (Pen p = new Pen(borderColor))
            {
                Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                e.Graphics.DrawRectangle(p, borderRect);
            }

            if (Highlight && !isHovered && !isPressed && Enabled)
            {
                using (Pen p = MetroPaint.GetStylePen(Style))
                {
                    Rectangle borderRect = new Rectangle(0, 0, Width - 1, Height - 1);
                    e.Graphics.DrawRectangle(p, borderRect);
                    borderRect = new Rectangle(1, 1, Width - 3, Height - 3);
                    e.Graphics.DrawRectangle(p, borderRect);
                }
            }
            if (IsShowCheck)
            {
                //if (_isChecked)
                //{
                //    Image bmp3 = smartpos.wpos.App.Components.Properties.Resources.单选2;
                //    Size size = new Size(bmp3.Width, bmp3.Height);
                //    Rectangle rect = new Rectangle(new Point(0, 0), size);
                //    e.Graphics.DrawImage(bmp3, rect, new Rectangle(0, 0, bmp3.Width, bmp3.Height), GraphicsUnit.Pixel);
                //}
                //else
                //{
                //    Image bmp3 = smartpos.wpos.App.Components.Properties.Resources.单选1;
                //    Size size = new Size(bmp3.Width, bmp3.Height);
                //    Rectangle rect = new Rectangle(new Point(0, 0), size);
                //    e.Graphics.DrawImage(bmp3, rect, new Rectangle(0, 0, bmp3.Width, bmp3.Height), GraphicsUnit.Pixel);
                //}
            }
            if (IsMutilColors)
            {
                if (MutilColors != null)
                {
                    foreach (var p in MutilColors)
                    {
                        Color mColor;
                        if (isHovered && !isPressed && Enabled)
                        {
                            mColor = p.HoverColor;
                        }
                        else if (isHovered && isPressed && Enabled)
                        {
                            mColor = p.PressColor;
                        }
                        else if (!Enabled)
                        {
                            mColor = p.DisableColor;
                        }
                        else
                        {
                            mColor = p.DefaultColor;
                        }
                        if (MutilColors.Count == 4) //这里表示无图模式的菜品
                        {
                            Rectangle temp = new Rectangle(ClientRectangle.X + ClientRectangle.Width / 15, ClientRectangle.Y + ClientRectangle.Height / 15, ClientRectangle.Width * 13 / 15,
                                                           ClientRectangle.Height * 13 / 15);
                            TextRenderer.DrawText(e.Graphics, p.Text, MetroFonts.Button(p.FontSize, metroButtonWeight),
                                                  temp, mColor, MetroPaint.GetTextFormatFlags(p.Alignment));
                        }
                        else
                        {
                            TextRenderer.DrawText(e.Graphics, p.Text, MetroFonts.Button(p.FontSize, metroButtonWeight),
                                                  ClientRectangle, mColor, MetroPaint.GetTextFormatFlags(p.Alignment));
                        }
                    }
                }
            }
            else
            {
                TextRenderer.DrawText(e.Graphics, Text, MetroFonts.Button(metroButtonSize, metroButtonWeight),
                                      ClientRectangle, foreColor, MetroPaint.GetTextFormatFlags(TextAlign));
            }
            OnCustomPaintForeground(new MetroPaintEventArgs(Color.Empty, foreColor, e.Graphics));

            if (displayFocusRectangle && isFocused)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, ClientRectangle);
            }
        }