Get the width of a (formatted) string?
-
how can i get the pixel width/height of a font formatted string? i know it'd be possible to use a System.Windows.Forms.Label by setting AutoSize on, but this is an ugly way, especially since this is for a web project...
-
how can i get the pixel width/height of a font formatted string? i know it'd be possible to use a System.Windows.Forms.Label by setting AutoSize on, but this is an ugly way, especially since this is for a web project...
Graphics g = someControl.CreateGraphics(); SizeF stringSize = g.MeasureString(theString, theFont, theFormat...); The graveyards are filled with indispensible men.
-
Graphics g = someControl.CreateGraphics(); SizeF stringSize = g.MeasureString(theString, theFont, theFormat...); The graveyards are filled with indispensible men.
thanks now only if that worked semi-accuratly for height :)