Example #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.Clear(_styleColor);

            e.Graphics.DrawString(
                (_number != 0) ? _number.ToString() : "",
                new Font(Font.FontFamily, _numberSize, FontStyle.Regular),
                new SolidBrush((Enabled) ? MetroPaint.ForeColor.Tile.Normal(_theme) : MetroPaint.ForeColor.Tile.Disabled(_theme)),
                new Rectangle(0, 6, Width - 6, Height - (Height / 2)),
                new StringFormat {
                Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Near
            });

            TextRenderer.DrawText(
                e.Graphics,
                Text,
                Font,
                new Rectangle(0, 0, Width - 1, Height - 1),
                (Enabled) ? MetroPaint.ForeColor.Tile.Normal(_theme) : MetroPaint.ForeColor.Tile.Disabled(_theme),
                _styleColor,
                _textAlign.ToTextFormatFlags() | TextFormatFlags.LeftAndRightPadding | TextFormatFlags.EndEllipsis);
        }