开发者

.NET Label Appearance TextAlign: MiddleRight problem

开发者 https://www.devze.com 2022-12-20 12:29 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消