Fix for new msgbox

This commit is contained in:
niksedk 2023-08-15 23:00:03 +02:00
parent 93b61b2972
commit ec9fb47f66

View File

@ -45,13 +45,9 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
InitializeComponent();
UiUtil.FixFonts(this);
InitializeIcon(icon);
InitializeText(text);
InitializeButtons(buttons);
labelText.Font = new Font(Font.FontFamily, Font.Size + 2);
Text = caption;
_text = text;
labelText.Font = new Font(Font.FontFamily, Font.Size + 2);
copyTextToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.CopyToClipboard;
buttonOK.Text = LanguageSettings.Current.General.Ok;
buttonCancel.Text = LanguageSettings.Current.General.Cancel;
@ -59,6 +55,10 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
buttonNo.Text = LanguageSettings.Current.General.No;
buttonAbort.Text = LanguageSettings.Current.DvdSubRip.Abort;
InitializeIcon(icon);
InitializeText(text);
InitializeButtons(buttons);
UiUtil.FixLargeFonts(this, buttonOK);
}
@ -137,9 +137,10 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
labelText.ContextMenuStrip = contextMenuStrip1;
using (var g = CreateGraphics())
{
var textSize = g.MeasureString(text, Font);
var textSize = g.MeasureString(text, labelText.Font);
Height = (int)textSize.Height + 90 + (Height - buttonOK.Top);
Width = (int)textSize.Width + 220;
var formWidth = (int)textSize.Width + 120;
Width = Math.Max(formWidth, 320);
}
labelText.Text = text;
@ -179,7 +180,7 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox
buttonControl.Width = buttonWidth;
buttonControl.Visible = true;
buttonControl.Left = start;
buttonControl.TabIndex = start;
buttonControl.TabIndex = Math.Max(0, start);
start += buttonWidth + 10;
}
}