LABEL padding isn't really zero

A

ags5406

i have a normal label with a fixed width font with no padding...

lblsizing.Font {Name = "Lucida Console" Size=12.0} System.Drawing.Font

lblsizing.Padding.All 0 Integer

but despite the fact that the padding property is set to zero, there
is still some bit of (natural) padding that is not adjustable... i
can determine this by observing the width of the label while adding
additional characters to the text of the label...

lblsizing.text lblsizing.width
"" 0
"A" 16
"AB" 26
"ABC" 36
"ABCD" 46
"ABCDE" 55
"ABCDEF" 65
"ABCDEFG" 75
"ABCDEFGH" 85
"ABCDEFGHI" 95
"ABCDEFGHIJ" 105
"ABCDEFGHIJK" 115
"ABCDEFGHIJKL" 125

looking at the widths, i can determine that adding an additional
character adds 9.xxx (almost 10) to the width, so the padding must be
roughly 6, or 3 on each side

i have no idea of the exact incremental width associated with adding
an additional character due to the .Width returning an integer...

anyway, i have multiple labels on multiple lines that may be offset
from each other and am having a very difficult time determining
what .LEFT value to give each label so that the characters line up in
perfect columns from the top of the form to the bottom...

any suggestions?
 
C

Chris Dunaway

i have a normal label with a fixed width font with no padding...

lblsizing.Font {Name = "Lucida Console" Size=12.0} System.Drawing.Font

lblsizing.Padding.All 0 Integer

but despite the fact that the padding property is set to zero, there
is still some bit of (natural) padding that is not adjustable... i
can determine this by observing the width of the label while adding
additional characters to the text of the label...

lblsizing.text lblsizing.width
"" 0
"A" 16
"AB" 26
"ABC" 36
"ABCD" 46
"ABCDE" 55
"ABCDEF" 65
"ABCDEFG" 75
"ABCDEFGH" 85
"ABCDEFGHI" 95
"ABCDEFGHIJ" 105
"ABCDEFGHIJK" 115
"ABCDEFGHIJKL" 125

looking at the widths, i can determine that adding an additional
character adds 9.xxx (almost 10) to the width, so the padding must be
roughly 6, or 3 on each side

i have no idea of the exact incremental width associated with adding
an additional character due to the .Width returning an integer...

anyway, i have multiple labels on multiple lines that may be offset
from each other and am having a very difficult time determining
what .LEFT value to give each label so that the characters line up in
perfect columns from the top of the form to the bottom...

any suggestions?

Have you considered using a TableLayoutPanel?

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top