TextRenderer.MeasureText and Graphics.MeasureString mismatch in size

Viewed 39488

This is not a rounding problem. Difference ~ 5+ pixels.

Test Case String: ""MACD (26,12,9) -0.000016"

e.Graphics.MeasureString("MACD (26,12,9) -0.000016", SystemFonts.DefaultFont).Width)
TextRenderer.MeasureText("MACD (26,12,9) -0.000016", SystemFonts.DefaultFont).Width)

The result is always:

139.3942
134

Why is there so much difference in size? I just need the round of width of string outside paint method. But it should match MeasureString or vice versa.

2 Answers
Related