Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove padding in Label control?

Tags:

.net

winforms

How can totally remove padding in Label control?

I tried to set Margin and Padding properties to zero, but still I have few pixels of margin inside Label.

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:

padding

I have this problem regardless of AutoSize property. There is always too much padding on right side of control.

In WPF it works as I want, but I have to use Windows Forms.

I can't use TextBox control (where it works as I want), because it does not support transparent background.

like image 452
Kamil Avatar asked Oct 28 '13 17:10

Kamil


1 Answers

Try to set UseCompatibleTextRendering property to true.

like image 66
Alexandre N. Avatar answered Sep 19 '22 21:09

Alexandre N.