C#标签自动调整大小添加填充 [英] C# label AutoSize adds padding

查看:202
本文介绍了C#标签自动调整大小添加填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows.Form的标签。我设置了标签为True的AutoSize属性,我注意到,当我做到这一点,胶垫〜右侧为5px的白色背景。我有填充属性设置为[0,0,0,0]。有没有摆脱这个办法吗?

I have a Label on a Windows.Form. I set the AutoSize property on the label to True and I noticed that when I do that, it pads the right hand side with ~5px of white background. I have the Padding property set to [0, 0, 0, 0]. Is there a way to get rid of this?

我想获得标签尽可能接近到标签内的文本的边界。

I would like to get the bounds of the label as close as possible to the text within the label.

推荐答案

有是当你只使用填充和利润率没有办法。这是默认的行为。

There's no way when you use only padding and margin. That's the default behavior.

在上面窗口我已经设置填充保证金 [0,0,0,0] 。这5个像素仍然存在。

In the above Window I've set the Padding and Margin to [0,0,0,0]. Those 5 pixels are still there.

如果您设置的FlatStyle =系统自动调整大小=假就可以得到这样的:

If you set FlatStyle = System and AutoSize = False you can get this:

在上面窗口你没有这些5个像素了。

In the above Window you don't have those 5 pixels anymore.

这篇关于C#标签自动调整大小添加填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆