I am trying to calculate the pixel width of Excel columns, as described in this post, using the official formula from the OpenXML specification. However, in order to apply t
TextRenderer is not always accurate the way you would expect:
From MSDN: http://msdn.microsoft.com/en-us/library/8wafk2kt.aspx
For example, the default behavior of the TextRenderer is to add padding to the bounding rectangle of the drawn text to accommodate overhanging glyphs
Do you have a Graphics object or a Control object? If you are using these you can get accurate restults the way you would expect.
Take a look at http://msdn.microsoft.com/en-us/library/6xe5hazb(VS.80).aspx