How to determine the size of a string given a font
It depends on the rendering engine being used. You can basically switch between GDI and GDI+. Switching can be done by setting the UseCompatibleTextRendering property accordingly When using GDI+ you should use MeasureString: string s = “A sample string”; SizeF size = e.Graphics.MeasureString(s, new Font(“Arial”, 24)); When using GDI (i.e. the native Win32 rendering) you … Read more