Last post Jun 22, 2007 09:52 AM by mike123
Jun 21, 2007 05:45 PM|mike123|LINK
I have a JPG, in which I am dynamically writing strings on top of it using graphics.drawString(). The strings are of variable lengths, and I want to make sure of a few things when I write the text on the image.
1.) I need to make sure that the text is centered.
2.) I also need to make sure that if the text is too long, it doesnt go past the outer limit of the JPG file. (If this is the case, I will probably lower the text size to help)
Is there a way I can somehow determine the length in pixels of the dynamic text I am writing on the JPG ? If so, how ?
Thanks very much!
Jun 21, 2007 06:51 PM|Benners_J|LINK
Check out the graphics.MeasureString(). It takes basically the same arguments as DrawString, and it returns the size of the text (as a SizeF).
Jun 22, 2007 09:52 AM|mike123|LINK