Label and TextBox: the same font looks different
I have Label
it TextBox
in Windows Forms, C #,. NET as well.
I see strange behavior: I set the same font to Label
and TextBox
, and it looks different in the same place:
Font - Tahoma, 10.25pt. As you can see, the top is Label
, and looks like if it had the Bold style compared to TextBox
. Why is this happening? Can I make mine TextBox
and label the same with this font?
source to share
This is caused by floating precision, it seems that labels choose to round while text boxes are rounded to the nearest integer (integer).
Perhaps WPF can get around this as it uses DirectX to render its drawing. Since winforms uses GDI, floating precision support within a drawing is not supported.
You might be better off using 10pt
it since 10.25
there isn't much else in between ... are you using it anyway for your textbox? :)
source to share