利用可能なキャンバスの特定の幅を考慮して、テキストの高さを測定したいと考えています。渡すテキストは非常に長く、折り返されることがわかっています。そのために、私は次のように呼びます。
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);
canvas に何を渡しても、常に 14 が返されsize.Height
ます。
簡単なものがありませんか?