title: Measure string height
body: <p>My program draws a multi-line text into a box in a PrintDocument using the PrintPage event. The width is set but the height should grow depending on the size of the text.</p>
  
  <pre><code>int BoxHeight = (int)e.Graphics.MeasureString(StringToDraw, FontToUse, BoxWidth).Height;
  </code></pre>
  
  <p>This returns mostly double the height that im looking for most of the time, but not always. The e object is the System.Drawing.Printing.PrintPageEventArgs handed to the PrintDocument.PrintPage-event. I want the box to fit the text tightly, wasting no dead trees for printing white empty spaces.</p>
  
  <p>I've searched for solutions but maybe theres something I didn't understand because I couldn't make them work for me.</p>