.NET Label Appearance TextAlign: MiddleRight problem
I'm having trouble right aligning a label.
I set the TextAlign to MiddleRight, yet when I change the text of the label the label autogrows right.
Is TextAlign the correct 开发者_开发百科parameter for setting the desigered behavior?
Is there a way to fix the problem other than using a TableLayoutPanel?
If the AutoSize
property is set to true
, then the text alignment will be meaningless (since text alignment determines where within the control boundaries that the text is drawn, but if the control is always the exact size of the text then it's always going to be in the same place, regardless of alignment).
It sounds like what you need to do is disable AutoSize
and set the label to the desired size and the desired text alignment.
精彩评论