Archive for the 'ironpython' Category


measuring a string using .net

Here’s how you get the width and height of a string using the .NET framework ( the example is for IronPython, but you can easily adjust this for any CLI language ) :

size = System.Windows.Forms.TextRenderer.MeasureText("measure this",font)
print size.Width
print size.Height

note that font must be the font you’re using to draw the string.

Blog Stats

  • 262,482 hits