From ec9fb47f6638fa2b3c8d1e1b4d16ef999faf5a4e Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 15 Aug 2023 23:00:03 +0200 Subject: [PATCH] Fix for new msgbox --- src/ui/Forms/SeMsgBox/MessageBoxForm.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ui/Forms/SeMsgBox/MessageBoxForm.cs b/src/ui/Forms/SeMsgBox/MessageBoxForm.cs index 18b312679..576240b10 100644 --- a/src/ui/Forms/SeMsgBox/MessageBoxForm.cs +++ b/src/ui/Forms/SeMsgBox/MessageBoxForm.cs @@ -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; } }