Weird AutoSize Label

I like User Interfaces where the label with the description is beneath the textbox where you input the data...

Like this:

The Labels have 2 important properties set:

this.label1.AutoSize = true;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;


When i change the text of the label in my code
(maybe localize it?)

It looks like this!

I have expected that it would be aligned right....

Dont use the AutoSize property, set it to false.
Set the width (Size) large enough...

this.label1.AutoSize = false;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Size = new System.Drawing.Size(100, 13);

1 comment:

Anonymous said...

simple and good solution.
thank you

Post a Comment

Latest Posts

Popular Posts