Be sure to read this KB article to know the cavets of GDI+ text output.
http://support.microsoft.com/?id=307208
Then consider using MeasureCharacterRanges if you need more accurate
results.
example:
textFormat.SetMeasurableCharacterRanges(new CharacterRange[] { new
CharacterRange(0, this.Text.Length()) } );
Region characterRegion = graphics.MeasureCharacterRanges(this.Text,
this.Font, new RectangleF(0, 0, float.MaxValue, float.MaxValue),
textFormat)[0];
ByronCullen
ThunderTools
"Jesper" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl...
How do I query the pixelwidth of string with given font.
In the Font class I cant seem to find any function to help
me out.
Thanx.
Jesper.