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;
BUT!!!!!!
When i change the text of the label in my code
(maybe localize it?)
It looks like this!
![](http://2.bp.blogspot.com/_7U9eu-U3X-8/RbiCSnJVX-I/AAAAAAAAAAs/guBIqyQHcpw/s320/label-TextAlign-AutoSize-after.gif)
Grrr!!!
I have expected that it would be aligned right....
SOLUTION:
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);
![](http://4.bp.blogspot.com/_7U9eu-U3X-8/RbiDHHJVX_I/AAAAAAAAAA8/a-OzFtY-iqo/s320/label-TextAlign-AutoSize-OK.gif)
1 comment:
simple and good solution.
thank you
Post a Comment