tags:

views:

45

answers:

1

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)

+1  A: 

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"

o.k.w