Release Graphics resources (Forms/Settings)

This commit is contained in:
Waldi Ravens 2015-05-27 14:44:54 +02:00
parent 6368b8bd0a
commit 4482d85954

View File

@ -814,14 +814,16 @@ namespace Nikse.SubtitleEdit.Forms
private void FixLargeFonts()
{
var graphics = CreateGraphics();
var textSize = graphics.MeasureString(buttonOK.Text, Font);
if (textSize.Height > buttonOK.Height - 4)
using (var graphics = CreateGraphics())
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
Utilities.SetButtonHeight(groupBoxSsaStyle, newButtonHeight, 2);
Utilities.SetButtonHeight(groupBoxWaveformAppearence, newButtonHeight, 1);
var textSize = graphics.MeasureString(buttonOK.Text, Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
Utilities.SetButtonHeight(groupBoxSsaStyle, newButtonHeight, 2);
Utilities.SetButtonHeight(groupBoxWaveformAppearence, newButtonHeight, 1);
}
}
}