private float GetFontHeight() { if (comboBoxSubtitleFont.SelectedItem == null || comboBoxSubtitleFontSize.SelectedItem == null) { return(Configuration.Settings.Tools.ExportLastLineHeight); } var mbp = new MakeBitmapParameter { SubtitleFontName = comboBoxSubtitleFont.SelectedItem.ToString(), SubtitleFontSize = int.Parse(comboBoxSubtitleFontSize.SelectedItem.ToString()), SubtitleFontBold = checkBoxBold.Checked, }; var fontSize = (float)TextDraw.GetFontSize(mbp.SubtitleFontSize); using (var font = GetFont(mbp, fontSize)) using (var bmp = new Bitmap(100, 100)) using (var g = Graphics.FromImage(bmp)) { var textSize = g.MeasureString("Hj!", font); return(textSize.Height); } }