I want to measure the height of the text given a certain width of available canvas. The text that I pass in is really long and I know will wrap. To that end, I call the following:
using System.Windows.Forms;
...
string text = "Really really long text that is sure to wrap...";
Font font = new Font("Arial", 14);
Size canvas = new Size(1100, 850);
Size size = TextRenderer.MeasureText(text, font, canvas);
No matter what I pass in for canvas, it always returns 14 for size.Height
.
Am I missing something simple?
Please, use the TextFormatFlags measure parameter as shown below: