开发者

How to find padding space around the label text?

I am adding a label controls at run time. I can add or modify text in label and can change the font also.Now my problem is When i changed the font of text in label, alignment is not proper,its due to padding.Is there any way to find how much padding is ocured开发者_运维技巧 [ed: obscured?] based on font?


Did you look at the Padding property?

You may have to turn off AutoSize to get better results.


Couldn't you call TextRenderer.MeasureText?

If you provide the correct target size (being the rectangle that the label can occupy), you should be able to find out how much space the text will occupy/has occupied.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜