Accuracy of TextRenderer.MeasureText results

I know it’s probably no actual anymore. Yet for future readers here is a simple yet accurate method of measuring text in a control:

Graphics g=Graphics.FromHwnd(YOUR CONTROL HERE.Handle);
SizeF s=g.MeasureString("YOUR STRING HERE", Font, NULL, NULL, STRING LENGTH HERE, 1)

Leave a Comment