Hi,
I've read most of the discussions about
"calculation of string width in pixels or points" - they mostly talk
about MeasureString (and that it's not exact width) or more presize
but requiring much more code MeasureCharacterRanges -
and no one answered this guy's question (I had the same) -
http://www.dotnet247.com/247referenc...39/198205.aspx
Any way, my task is _not_ to draw anything but for existing fixed-width
font - "MS Sans Serif, 8" - to calculate the width of the string, so I
used this simplistic approach I've found on the Web:
string Label;
.....
Font defFont = new Font("MS Sans Serif", 8);
float TextWidth = defFont.SizeInPoints * Label.Length;
Works Ok, but I saw on screen that if I choose a Bold variant of
the font, then the string width _increases_.
So I did the following, but .NET C# returns me the same value
as with non-Bold case:
Font defFontBold = new Font("MS Sans Serif", 8,
(System.Drawing.FontStyle)1);
float TextBoldWidth = defFontBold.SizeInPoints * Label.Length;
Does anyone know why SizeInPoints is not changing for Bold style?
--
Regards,
Paul