Add more use of new ext method to fix large font (Part 2)

This commit is contained in:
ivandrofly 2015-05-23 20:48:07 +01:00
parent b52e69e137
commit ea3870f74f
10 changed files with 9 additions and 82 deletions

View File

@ -462,7 +462,6 @@ namespace Nikse.SubtitleEdit.Forms
numericUpDownDuration.Left = timeUpDownStartTime.Left + timeUpDownStartTime.Width;
labelDuration.Left = timeUpDownStartTime.Left + timeUpDownStartTime.Width - 3;
FixLargeFonts();
listView1.Select();
}

View File

@ -85,14 +85,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (labelDescription1.Left + labelDescription1.Width + 5 > Width)
Width = labelDescription1.Left + labelDescription1.Width + 5;
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonOK);
}
private void FormGetDictionaries_KeyDown(object sender, KeyEventArgs e)

View File

@ -77,14 +77,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (labelDescription1.Left + labelDescription1.Width + 5 > Width)
Width = labelDescription1.Left + labelDescription1.Width + 5;
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonOK);
}
private void buttonDownload_Click(object sender, EventArgs e)

View File

@ -27,18 +27,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonMicrosoft.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.MicrosoftTranslate;
buttonTranslate.Text = Configuration.Settings.Language.GoogleOrMicrosoftTranslate.Translate;
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
FixLargeFonts();
}
private void FixLargeFonts()
{
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonCancel.Text, this.Font);
if (textSize.Height > buttonCancel.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonCancel);
}
private static void RemovedLanguagesNotInMicrosoftTranslate(ComboBox comboBox)

View File

@ -45,13 +45,12 @@ namespace Nikse.SubtitleEdit.Forms
private void AddInputFile(string fileName)
{
try
{
FileInfo fi = new FileInfo(fileName);
var item = new ListViewItem(fileName);
item.SubItems.Add(Utilities.FormatBytesToDisplayFileSize(fi.Length));
string ext = Path.GetExtension(fileName).ToLower();
string ext = Path.GetExtension(fileName).ToLowerInvariant();
if (ext == ".png" || ext == ".jpg" || ext == ".bmp" || ext == ".gif" || ext == ".tif" || ext == ".tiff")
{
SetTimeCodes(fileName, item);

View File

@ -30,18 +30,7 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxTimeCodes.Text = Configuration.Settings.Language.ImportSceneChanges.TimeCodes;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
FixLargeFonts();
}
private void FixLargeFonts()
{
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonOK);
}
private void buttonOpenText_Click(object sender, EventArgs e)

View File

@ -72,7 +72,7 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxLineBreak.Text = Configuration.Settings.Tools.ImportTextLineBreak;
numericUpDownDurationFixed.Enabled = radioButtonDurationFixed.Checked;
FixLargeFonts();
Utilities.FixLargeFonts(this, buttonOK);
_refreshTimer.Interval = 400;
_refreshTimer.Tick += RefreshTimerTick;
}
@ -83,17 +83,6 @@ namespace Nikse.SubtitleEdit.Forms
GeneratePreviewReal();
}
private void FixLargeFonts()
{
Graphics graphics = CreateGraphics();
SizeF 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);
}
}
private void ButtonOpenTextClick(object sender, EventArgs e)
{
openFileDialog1.Title = buttonOpenText.Text;

View File

@ -52,19 +52,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
buttonOK.Text = Configuration.Settings.Language.General.Ok;
FixLargeFonts();
}
private void FixLargeFonts()
{
Graphics graphics = this.CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonOK.Text, this.Font);
if (textSize.Height > buttonOK.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonOK);
}
private void buttonAdd_Click(object sender, EventArgs e)

View File

@ -34,19 +34,7 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxPreview.Text = Configuration.Settings.Language.JoinSubtitles.Information;
buttonJoin.Text = Configuration.Settings.Language.JoinSubtitles.Join;
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
FixLargeFonts();
}
private void FixLargeFonts()
{
Graphics graphics = CreateGraphics();
SizeF textSize = graphics.MeasureString(buttonCancel.Text, Font);
if (textSize.Height > buttonCancel.Height - 4)
{
int newButtonHeight = (int)(textSize.Height + 7 + 0.5);
Utilities.SetButtonHeight(this, newButtonHeight, 1);
}
Utilities.FixLargeFonts(this, buttonCancel);
}
private void buttonCancel_Click(object sender, EventArgs e)

View File

@ -3449,4 +3449,4 @@ namespace Nikse.SubtitleEdit.Logic
}
}
}
}