From 999310dbf6c7b8060b50aa0934d34e35857e3690 Mon Sep 17 00:00:00 2001 From: Lesandro Gotardo <148582027+lesandrog@users.noreply.github.com> Date: Mon, 22 Jun 2026 16:32:53 -0300 Subject: [PATCH] V110-Adjustment-position-size-buttons-KryptonMessageBox --- Documents/Changelog/Changelog.md | 1 + .../Controls Visuals/VisualMessageBoxForm.Designer.cs | 8 ++++---- .../Controls Visuals/VisualMessageBoxForm.cs | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Documents/Changelog/Changelog.md b/Documents/Changelog/Changelog.md index 00fc9e41b7..3d0e046493 100644 --- a/Documents/Changelog/Changelog.md +++ b/Documents/Changelog/Changelog.md @@ -45,6 +45,7 @@ ## 2026-11-xx - Build 2611 (V110 Nightly) - November 2026 +* Resolved [#3767](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3767), Adjust the position and size of the buttons in the `KryptonMessageBox` * Resolved [#1870](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1870), Restored `BasePaletteMode` in `KryptonCustomPaletteBase` * Resolved [#3751](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3751), `Krypton.Standard.Toolkit.Nightly` NuGet package does not upload * Implemented [#3657](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3657), OS X Aqua Themes diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs index 636440b70d..d9c6d4211f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs @@ -103,7 +103,7 @@ private void InitializeComponent() // _button4 // this._button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._button4.AutoSize = true; + this._button4.AutoSize = false; this._button4.Enabled = false; this._button4.IgnoreAltF4 = false; this._button4.Location = new System.Drawing.Point(203, 0); @@ -119,7 +119,7 @@ private void InitializeComponent() // _button3 // this._button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._button3.AutoSize = true; + this._button3.AutoSize = false; this._button3.Enabled = false; this._button3.IgnoreAltF4 = false; this._button3.Location = new System.Drawing.Point(166, 0); @@ -135,7 +135,7 @@ private void InitializeComponent() // _button1 // this._button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._button1.AutoSize = true; + this._button1.AutoSize = false; this._button1.Enabled = false; this._button1.IgnoreAltF4 = false; this._button1.Location = new System.Drawing.Point(90, 0); @@ -151,7 +151,7 @@ private void InitializeComponent() // _button2 // this._button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._button2.AutoSize = true; + this._button2.AutoSize = false; this._button2.Enabled = false; this._button2.IgnoreAltF4 = false; this._button2.Location = new System.Drawing.Point(128, 0); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs index f6b4adb7ca..e278947a1c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs @@ -608,9 +608,12 @@ private Size UpdateButtonsSizing() { var numButtons = 1; + //Maximum width "Try Again" 62px + var minButtonWith = 62; + // Button1 is always visible Size button1Size = _button1.GetPreferredSize(Size.Empty); - var maxButtonSize = button1Size with { Width = button1Size.Width + GlobalStaticConstants.GLOBAL_BUTTON_PADDING }; + var maxButtonSize = button1Size with { Width = Math.Max(minButtonWith, button1Size.Width) + GlobalStaticConstants.GLOBAL_BUTTON_PADDING }; // If Button2 is visible if (_button2.Enabled) @@ -852,4 +855,4 @@ protected override void WndProc(ref Message m) base.WndProc(ref m); } #endregion -} \ No newline at end of file +}