c# 计算文字高度

SizeF sizeF = g.MeasureString(listBox1.Items[e.Index].ToString(), e.Font, listBox1.Width);