如何在Label控件中删除填充? [英] How to remove padding in Label control?
问题描述
如何完全删除Label控件中的填充?
How can totally remove padding in Label control?
我试图将Margin和Padding属性设置为零,但在Label内仍然有很少的边距像素.
I tried to set Margin and Padding properties to zero, but still I have few pixels of margin inside Label.
我希望Windows窗体中的左右填充为零或非常小(小于空格"字符宽度的一半).
I want zero or very small (less than half of "space" character width) left and right padding in Windows Forms.
我需要这样做,以便将标签放置在与其他标签非常接近的位置,但是当我将标签放置在非常靠近的位置时-位于顶部的标签背景会覆盖其他标签文本.我在一个标签上使用右对齐,在另一个标签上使用左对齐,看起来像这样:
I need this for label placed very close to other, but when I place labels very close - background of label placed on top covers other label text. I use right align on one label, left on other label and it looks like this:
无论AutoSize属性如何,我都会遇到此问题.控件的右侧总是有太多填充.
I have this problem regardless of AutoSize property. There is always too much padding on right side of control.
在WPF中,它可以按我的要求工作,但是我必须使用Windows窗体.
In WPF it works as I want, but I have to use Windows Forms.
我不能使用TextBox控件(它可以在我想要的位置工作),因为它不支持透明背景.
I can't use TextBox control (where it works as I want), because it does not support transparent background.
推荐答案
尝试将UseCompatibleTextRendering属性设置为 true .
Try to set UseCompatibleTextRendering property to true.
这篇关于如何在Label控件中删除填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!