1private int MeasureStringHeight(int width, string textToMeasure, Font font)
2{
3 Bitmap bmp = new Bitmap(1,1);
4 Graphics g = Graphics.FromImage(bmp);
5 SizeF bounds = g.MeasureString(textToMeasure, font, width);
6 int height = Convert.ToInt32(bounds.Height);
7 //This part is to convert pixels to inches, which is what I needed.
8 //You could just return height for pixels
9 return height/g.DpiY;
10}