Lets say I've a string and some font (name, size, etc...).
How to get width and height, measured in pixels, of such string displayed on the screen?
views:
80answers:
2
+3
A:
The easy answer is Graphics.MeasureString. But it's rather infamous for not being particularly accurate. If you need better accuracy you can check out this article: Using MeasureCharacterRanges to Draw Text.
danbystrom
2010-03-20 14:54:54
eg. sucks with multiline
WooYek
2010-03-20 14:56:30
+1
A:
You didn't specify if you were using WinForms or ASP.NET.
If this is a web site, the answer I gave on this question can be easily distilled to a working solution for your question:
richardtallent
2010-03-20 14:58:39
I'm using WinForms, but Your answer might be helpful in the future, so thanks anyway.
Tomek Tarczynski
2010-03-20 15:05:23