Hi,
Is there a way to measure the width of a string drawn with Bitmap.DrawText ?
In the full framework there’s Graphics.MeasureString … is there something like this in the MF ?
Hi,
Is there a way to measure the width of a string drawn with Bitmap.DrawText ?
In the full framework there’s Graphics.MeasureString … is there something like this in the MF ?
DrawText returns the width of text in pixels
Hey,
I just checked… it returns void …
Also… if I want to know the width of the text so I can create a Bitmap instance with that width.
Are we talking about the same class.
Ìn the past it was supported though:
[ObsoleteAttribute]
public int DrawText (
string text,
int xPos,
int yPos,
Font font
)
So they must have provided a new way to do it right?
Yes, you are right. That one is obsolete. Try ComputeExtent from the Font class:
Thnx!
That makes more sense as well
as now you can measure the text before you create the bitmap to hold it.
Did not think to look there.
Life saver!