Strange behavior while computing string width in pixels for simulation of word wrap
问题 Trying to get string width in C# to simulate wordwrap and position of text (now written in richTextBox). Size of richTextBox is 555x454 px and I use monospaced font Courier New 12pt. I tried TextRenderer.MeasureText() and also Graphics.MeasureString() methods. TextRenderer was returning bigger values than Graphics so text which normally fits into one line, my code determined should be wrapped to other line. But with using Graphics , on the other hand, my code determined that particular string