I have a problem with the TextAlign
property of my labels. I created a new class, based on the label class, to override the OnPaint
event. I had to override this because I didn't want the label to change the ForeColer
if disabled.
I don't really want to disable the labels because it doesn't make sense but the labels are in a other control which has to be disabled and therefore the labels are also disabled.
I used this OnPaint
methode which allows me to set any forecoler I want even if it is disabled:
protected override void OnPaint(PaintEventArgs e)
{
TextRenderer.DrawText(e.Graphics, this.Text.ToString(), this.Font, ClientRectangle, ForeColor);
}
But now the TextAlign
property doesn't work because of the new OnPaint methode.
Do you have any suggestions to achieve both requirements? The change of ForeColor
while the label is disabled and the option to align the text through TextAlign
property.