79353514

Date: 2025-01-13 21:53:50
Score: 0.5
Natty:
Report link

I already solved my problem by adding two lines here Alpha in ForeColor

public class TLabel : Label
{
    protected override void OnPaint(PaintEventArgs e)
    {
        Rectangle rc = this.ClientRectangle;
        StringFormat fmt = new StringFormat(StringFormat.GenericTypographic);
        fmt.Alignment = StringAlignment.Center;
        fmt.LineAlignment = StringAlignment.Center;
        using (var br = new SolidBrush(this.ForeColor))
        {
            e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
        }
    }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Anuta