I am drawing text on a screen using graphicsObject.DrawString().
Prior to doing this I need to determine the length in pixels that the string
will be when it is rendered. I know I've read this before but can not find
it now that I need it.
Also - is there a simple way to center the text within a rectangel?
And - Thanks for your responses I really appreciate it!
Hi,
"HaySeed" <HaySeed@discussions.microsoft.com> schrieb:
>I am drawing text on a screen using graphicsObject.DrawString().
>
[quoted text clipped - 3 lines]
> find
> it now that I need it.
Check out the 'Graphics' object's 'MeasureString' method.
> Also - is there a simple way to center the text within a rectangel?
There is an overloaded version of 'DrawString' which has parameters
'layoutRectangle' and 'format'. You can specify the alignment in the
'StringFormat' passed to the 'format' parameter.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>