C# - TextRenderer.MeasureText is a few pixels too wide
问题 I'm using TextRendere.MeasureText instead of Graphics.MeasureString because it allows me to specify TextFormatFlags.NoPadding, but its return width is a few pixels to wide. For a four character text string its five pixels over and for a five character text string its six pixels over. I'm sure its going to be even more with longer text strings. I'm using .Net 4.5.1. Here's my code: Size size = TextRenderer.MeasureText(items[a], new Font("Segoe UI", 12, GraphicsUnit.Pixel), new Size(Width, 15),