Is there a formula for textbox widths as a multiple of max. characters?
I assume that if my textbox holds 40 characters, I should be able to plug it into a formula that looks like F(40) = (40 * X + Y).
Is there a formula for textbox widths as a multiple of max. characters?
I assume that if my textbox holds 40 characters, I should be able to plug it into a formula that looks like F(40) = (40 * X + Y).
I think it really depends on the font you are using. I'm sorry for not giving you the formula, but you can find FormattedText class helpful. Especially its Width property.
In case of fixed-width fonts it's as easy as measuring any character width with FormattedText
, and multiplying it by number of characters. In other cases things get trickier...
For the time being I'm using width(n) = 11n+8
. This is based on the defaults for Windows 7 and the width of the M character.