Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing labels in Winforms to Left

I have 15 to 20 labels with variable text sizes and text boxes arranged in the forms. Text boxes are arranged next to labels. The font and color of the form and hence the form controls can be configured by the user at run time. When I right align the labels and set auto grow property to true and whenever the font style changes (say from Arial to Georgia) the right aligned labels are no more right aligned.

I need a solution on labels (for winforms) to automatically grow to the left when the font size changes.

like image 403
Nagesh Avatar asked Dec 16 '22 23:12

Nagesh


1 Answers

Set your label properties as folowing;

AutoSize = false;
TextAlign = TopRight (or anything to right)

Then manually resize your label to a maximum area to fit your longest text. That worked for me.

like image 104
bmkorkut Avatar answered Dec 24 '22 00:12

bmkorkut