0

If I have a Control, I can know the Font it is using by the Font Property. Now how can I know the average Size of the Font( or lets say I would like to know what would it be the width of the 'M' char)

I know that Graphics.MeasureString() would solve my problem but implies creating a graphic object since I'm not in any paint event.. or wouldn't like to use the CreateGraphics. or nothing like that. I'm raising a grid and would like to set my column Width since I have all my columns text information. (THis is for Winforms..... NOT WPF)

jmayor
  • 2,725
  • 4
  • 29
  • 37

1 Answers1

1

I am afraid there might not be a guaranteed accurate measurement, you can try TextRenderer.MeasureText.

A good post in SO here on "Accuracy of TextRenderer.MeasureText results"

Community
  • 1
  • 1
o.k.w
  • 25,490
  • 6
  • 66
  • 63