From 9dda40f5d1b9c5300c38b929f06420dc3b647bae Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Mon, 6 Jun 2022 08:54:35 +0100 Subject: [PATCH 1/5] * Semi implement #728, with points 2 & 4 outstanding --- Documents/Help/Changelog.md | 5 +- .../Controls Visuals/KryptonMessageBoxForm.cs | 86 +++++++++++++++++++ .../Krypton.Toolkit/General/GlobalStrings.cs | 43 +++++++++- 3 files changed, 131 insertions(+), 3 deletions(-) diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index df25138bc..0760485ac 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -5,7 +5,10 @@ ======= ## 2022-11-xx - Build 2211 - November 2022 +* Implemented [#728](https://github.com/Krypton-Suite/Standard-Toolkit/issues/728), Bring MessageBox `States` inline with latest .Net 6 * Made enumeration `SchemeOfficeColors` public, so they can be used to make external themes +* Resolved [#722](https://github.com/Krypton-Suite/Standard-Toolkit/issues/722), KryptonRichTextBox disabled colour cannot be set +* Resolved [#662](https://github.com/Krypton-Suite/Standard-Toolkit/issues/662), Can not "Control / Set Disabled" Background Colour Of Comboboxes, in DropDown mode * Resolved [#715](https://github.com/Krypton-Suite/Standard-Toolkit/issues/715), v65.22.4.94 - PaletteSparkleBlueBase.GetContentPadding: Specified argument was out of the range of valid values. Parameter name: style * Implemented the `PlacementModeConverter` for `PlacementMode` enum type * Implemented [#551](https://github.com/Krypton-Suite/Standard-Toolkit/issues/551), `DropShadow` should now be off and deprecated @@ -24,8 +27,6 @@ * Blue dark mode themes now have a darker alternate colour * Added new `GetPaletteModeManager()` method to the `ThemeManager` API, to return the current `PaletteModeManager` of the selected `KryptonManager` * Update documentation for `PaletteMode` and `PaletteModeManager` -* Resolved [#722](https://github.com/Krypton-Suite/Standard-Toolkit/issues/722), KryptonRichTextBox disabled colour cannot be set -* Resolved [#662](https://github.com/Krypton-Suite/Standard-Toolkit/issues/662), Can not "Control / Set Disabled" Background Colour Of Comboboxes, in DropDown mode * Resolved [#701](https://github.com/Krypton-Suite/Standard-Toolkit/issues/701), `CueHint` in `KryptonPalette` does not work * Resolved [#697](https://github.com/Krypton-Suite/Standard-Toolkit/issues/697), Number 9 is handled in ribbon textbox/richtextbox. * Resolved [#693](https://github.com/Krypton-Suite/Standard-Toolkit/issues/693), Docked controls are rendered with smaller size which hides the caption/title text. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs index f5bf20b74..a67144c69 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs @@ -251,6 +251,91 @@ private void UpdateIcon() private void UpdateButtons() { +#if NET6_0 + switch (_buttons) + { + case MessageBoxButtons.OK: + _button1.Text = KryptonManager.Strings.OK; + _button1.DialogResult = DialogResult.OK; + _button1.Visible = true; + _button1.Enabled = true; + break; + case MessageBoxButtons.OKCancel: + _button1.Text = KryptonManager.Strings.OK; + _button2.Text = KryptonManager.Strings.Cancel; + _button1.DialogResult = DialogResult.OK; + _button2.DialogResult = DialogResult.Cancel; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + break; + case MessageBoxButtons.CancelTryContinue: + _button1.Text = KryptonManager.Strings.Cancel; + _button2.Text = KryptonManager.Strings.TryAgain; + _button3.Text = KryptonManager.Strings.Continue; + _button1.DialogResult = DialogResult.Cancel; + _button2.DialogResult = DialogResult.TryAgain; + _button3.DialogResult = DialogResult.Continue; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + _button3.Visible = true; + _button3.Enabled = true; + break; + case MessageBoxButtons.YesNo: + _button1.Text = KryptonManager.Strings.Yes; + _button2.Text = KryptonManager.Strings.No; + _button1.DialogResult = DialogResult.Yes; + _button2.DialogResult = DialogResult.No; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + ControlBox = false; + break; + case MessageBoxButtons.YesNoCancel: + _button1.Text = KryptonManager.Strings.Yes; + _button2.Text = KryptonManager.Strings.No; + _button3.Text = KryptonManager.Strings.Cancel; + _button1.DialogResult = DialogResult.Yes; + _button2.DialogResult = DialogResult.No; + _button3.DialogResult = DialogResult.Cancel; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + _button3.Visible = true; + _button3.Enabled = true; + break; + case MessageBoxButtons.RetryCancel: + _button1.Text = KryptonManager.Strings.Retry; + _button2.Text = KryptonManager.Strings.Cancel; + _button1.DialogResult = DialogResult.Retry; + _button2.DialogResult = DialogResult.Cancel; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + break; + case MessageBoxButtons.AbortRetryIgnore: + _button1.Text = KryptonManager.Strings.Abort; + _button2.Text = KryptonManager.Strings.Retry; + _button3.Text = KryptonManager.Strings.Ignore; + _button1.DialogResult = DialogResult.Abort; + _button2.DialogResult = DialogResult.Retry; + _button3.DialogResult = DialogResult.Ignore; + _button1.Visible = true; + _button1.Enabled = true; + _button2.Visible = true; + _button2.Enabled = true; + _button3.Visible = true; + _button3.Enabled = true; + ControlBox = false; + break; + } +#else switch (_buttons) { case MessageBoxButtons.OK: @@ -320,6 +405,7 @@ private void UpdateButtons() ControlBox = false; break; } +#endif // Do we ignore the Alt+F4 on the buttons? if (!ControlBox) diff --git a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs index f21f5f4e4..da3c9eb77 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs @@ -33,6 +33,10 @@ public class GlobalStrings : GlobalId private const string DEFAULT_CLOSE = "Cl&ose"; private const string DEFAULT_TODAY = "T&oday"; private const string DEFAULT_HELP = "H&elp"; + + // NET 6 & newer + private const string DEFAULT_CONTINUE = "Co&ntinue"; + private const string DEFAULT_TRY = "&Try Again"; #endregion #region Instance Fields @@ -62,6 +66,20 @@ public GlobalStrings() /// /// True if all values are defaulted; otherwise false. [Browsable(false)] +#if NET6_0 + public bool IsDefault => OK.Equals(DEFAULT_OK) && + Cancel.Equals(DEFAULT_CANCEL) && + Yes.Equals(DEFAULT_YES) && + No.Equals(DEFAULT_NO) && + Abort.Equals(DEFAULT_ABORT) && + Retry.Equals(DEFAULT_RETRY) && + Ignore.Equals(DEFAULT_IGNORE) && + Close.Equals(DEFAULT_CLOSE) && + Today.Equals(DEFAULT_TODAY) && + Help.Equals(DEFAULT_HELP) && + Continue.Equals(DEFAULT_CONTINUE) && + TryAgain.Equals(DEFAULT_TRY); +#else public bool IsDefault => OK.Equals(DEFAULT_OK) && Cancel.Equals(DEFAULT_CANCEL) && Yes.Equals(DEFAULT_YES) && @@ -72,6 +90,7 @@ public GlobalStrings() Close.Equals(DEFAULT_CLOSE) && Today.Equals(DEFAULT_TODAY) && Help.Equals(DEFAULT_HELP); +#endif /// /// Reset all strings to default values. @@ -88,6 +107,10 @@ public void Reset() Close = DEFAULT_CLOSE; Today = DEFAULT_TODAY; Help = DEFAULT_HELP; + + // NET 6 & newer + Continue = DEFAULT_CONTINUE; + TryAgain = DEFAULT_TRY; } /// @@ -190,6 +213,24 @@ public void Reset() [DefaultValue(DEFAULT_HELP)] [RefreshProperties(RefreshProperties.All)] public string Help { get; set; } - #endregion + + /// + /// Gets and sets the Continue string used in calendars. + /// + [Localizable(true)] + [Category(@"Visuals")] + [Description(@"Continue string used for Message Box Buttons.")] + [DefaultValue(DEFAULT_CONTINUE)] + public string Continue { get; set; } + + /// + /// Gets and sets the Try Again string used in calendars. + /// + [Localizable(true)] + [Category(@"Visuals")] + [Description(@"Try Again string used for Message Box Buttons.")] + [DefaultValue(DEFAULT_TRY)] + public string TryAgain { get; set; } +#endregion } } From 0a3aacc7b4ad90d7ff37fe7bc6326a6b954bef35 Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Mon, 6 Jun 2022 09:33:37 +0100 Subject: [PATCH 2/5] * Redo #if statements --- .../Controls Visuals/KryptonMessageBoxForm.cs | 88 ++----------------- .../Krypton.Toolkit/General/GlobalStrings.cs | 14 +-- 2 files changed, 10 insertions(+), 92 deletions(-) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs index a67144c69..bd765dbee 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs @@ -251,7 +251,6 @@ private void UpdateIcon() private void UpdateButtons() { -#if NET6_0 switch (_buttons) { case MessageBoxButtons.OK: @@ -270,20 +269,6 @@ private void UpdateButtons() _button2.Visible = true; _button2.Enabled = true; break; - case MessageBoxButtons.CancelTryContinue: - _button1.Text = KryptonManager.Strings.Cancel; - _button2.Text = KryptonManager.Strings.TryAgain; - _button3.Text = KryptonManager.Strings.Continue; - _button1.DialogResult = DialogResult.Cancel; - _button2.DialogResult = DialogResult.TryAgain; - _button3.DialogResult = DialogResult.Continue; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - _button3.Visible = true; - _button3.Enabled = true; - break; case MessageBoxButtons.YesNo: _button1.Text = KryptonManager.Strings.Yes; _button2.Text = KryptonManager.Strings.No; @@ -334,78 +319,23 @@ private void UpdateButtons() _button3.Enabled = true; ControlBox = false; break; - } -#else - switch (_buttons) - { - case MessageBoxButtons.OK: - _button1.Text = KryptonManager.Strings.OK; - _button1.DialogResult = DialogResult.OK; - _button1.Visible = true; - _button1.Enabled = true; - break; - case MessageBoxButtons.OKCancel: - _button1.Text = KryptonManager.Strings.OK; - _button2.Text = KryptonManager.Strings.Cancel; - _button1.DialogResult = DialogResult.OK; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case MessageBoxButtons.YesNo: - _button1.Text = KryptonManager.Strings.Yes; - _button2.Text = KryptonManager.Strings.No; - _button1.DialogResult = DialogResult.Yes; - _button2.DialogResult = DialogResult.No; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - ControlBox = false; - break; - case MessageBoxButtons.YesNoCancel: - _button1.Text = KryptonManager.Strings.Yes; - _button2.Text = KryptonManager.Strings.No; - _button3.Text = KryptonManager.Strings.Cancel; - _button1.DialogResult = DialogResult.Yes; - _button2.DialogResult = DialogResult.No; - _button3.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - _button3.Visible = true; - _button3.Enabled = true; - break; - case MessageBoxButtons.RetryCancel: - _button1.Text = KryptonManager.Strings.Retry; - _button2.Text = KryptonManager.Strings.Cancel; - _button1.DialogResult = DialogResult.Retry; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case MessageBoxButtons.AbortRetryIgnore: - _button1.Text = KryptonManager.Strings.Abort; - _button2.Text = KryptonManager.Strings.Retry; - _button3.Text = KryptonManager.Strings.Ignore; - _button1.DialogResult = DialogResult.Abort; - _button2.DialogResult = DialogResult.Retry; - _button3.DialogResult = DialogResult.Ignore; +#if NET6_0 + case MessageBoxButtons.CancelTryContinue: + _button1.Text = KryptonManager.Strings.Cancel; + _button2.Text = KryptonManager.Strings.TryAgain; + _button3.Text = KryptonManager.Strings.Continue; + _button1.DialogResult = DialogResult.Cancel; + _button2.DialogResult = DialogResult.TryAgain; + _button3.DialogResult = DialogResult.Continue; _button1.Visible = true; _button1.Enabled = true; _button2.Visible = true; _button2.Enabled = true; _button3.Visible = true; _button3.Enabled = true; - ControlBox = false; break; - } #endif + } // Do we ignore the Alt+F4 on the buttons? if (!ControlBox) diff --git a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs index da3c9eb77..fad0f8115 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs @@ -61,12 +61,12 @@ public GlobalStrings() #endregion #region Public + /// /// Gets a value indicating if all the strings are default values. /// /// True if all values are defaulted; otherwise false. [Browsable(false)] -#if NET6_0 public bool IsDefault => OK.Equals(DEFAULT_OK) && Cancel.Equals(DEFAULT_CANCEL) && Yes.Equals(DEFAULT_YES) && @@ -79,18 +79,6 @@ public GlobalStrings() Help.Equals(DEFAULT_HELP) && Continue.Equals(DEFAULT_CONTINUE) && TryAgain.Equals(DEFAULT_TRY); -#else - public bool IsDefault => OK.Equals(DEFAULT_OK) && - Cancel.Equals(DEFAULT_CANCEL) && - Yes.Equals(DEFAULT_YES) && - No.Equals(DEFAULT_NO) && - Abort.Equals(DEFAULT_ABORT) && - Retry.Equals(DEFAULT_RETRY) && - Ignore.Equals(DEFAULT_IGNORE) && - Close.Equals(DEFAULT_CLOSE) && - Today.Equals(DEFAULT_TODAY) && - Help.Equals(DEFAULT_HELP); -#endif /// /// Reset all strings to default values. From 89762d7dc1ff639b53bc81b826f6ff135936dbea Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Mon, 6 Jun 2022 10:45:54 +0100 Subject: [PATCH 3/5] * Try to implement `MdiChildrenMinimizedAnchorBottom` --- .../Controls Visuals/VisualForm.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs index 9e4e50344..1e15fa8a0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs @@ -619,6 +619,22 @@ public void RecalcNonClient() PI.SWP_.NOOWNERZORDER | PI.SWP_.FRAMECHANGED); } } + + /// Gets or sets the anchoring for minimized MDI children. + /// true to anchor minimized MDI children to the bottom left of the parent form; false to anchor to the top left of the parent form. + [Category(@"Window Style")] + [Description(@"Gets or sets the anchoring for minimized MDI children.")] + [DefaultValue(true)] + public new bool MdiChildrenMinimizedAnchorBottom + { + get => base.MdiChildrenMinimizedAnchorBottom; + + set + { + base.MdiChildrenMinimizedAnchorBottom = value; + throw new NotSupportedException(@"Please use .NET 6 or newer to use this feature."); + } + } #endregion #region Public Chrome From 5103f7e0269e5f84d68fea1cdabcaef43a5e08a4 Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Mon, 6 Jun 2022 10:50:03 +0100 Subject: [PATCH 4/5] Update GlobalStrings.cs --- .../Krypton.Toolkit/General/GlobalStrings.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs index fad0f8115..a0ac01220 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStrings.cs @@ -36,7 +36,7 @@ public class GlobalStrings : GlobalId // NET 6 & newer private const string DEFAULT_CONTINUE = "Co&ntinue"; - private const string DEFAULT_TRY = "&Try Again"; + private const string DEFAULT_TRY_AGAIN = "&Try Again"; #endregion #region Instance Fields @@ -78,7 +78,7 @@ public GlobalStrings() Today.Equals(DEFAULT_TODAY) && Help.Equals(DEFAULT_HELP) && Continue.Equals(DEFAULT_CONTINUE) && - TryAgain.Equals(DEFAULT_TRY); + TryAgain.Equals(DEFAULT_TRY_AGAIN); /// /// Reset all strings to default values. @@ -98,7 +98,7 @@ public void Reset() // NET 6 & newer Continue = DEFAULT_CONTINUE; - TryAgain = DEFAULT_TRY; + TryAgain = DEFAULT_TRY_AGAIN; } /// @@ -217,7 +217,7 @@ public void Reset() [Localizable(true)] [Category(@"Visuals")] [Description(@"Try Again string used for Message Box Buttons.")] - [DefaultValue(DEFAULT_TRY)] + [DefaultValue(DEFAULT_TRY_AGAIN)] public string TryAgain { get; set; } #endregion } From 6f5d0e3f3d4c8f6f35afa085bef854a5c0cbc341 Mon Sep 17 00:00:00 2001 From: Peter Wagner Date: Fri, 10 Jun 2022 17:15:32 +0100 Subject: [PATCH 5/5] * IF defs --- .../Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs | 2 +- .../Krypton.Toolkit/Controls Visuals/VisualForm.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs index bd765dbee..b521bc903 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs @@ -319,7 +319,7 @@ private void UpdateButtons() _button3.Enabled = true; ControlBox = false; break; -#if NET6_0 +#if NET6_0_OR_GREATER case MessageBoxButtons.CancelTryContinue: _button1.Text = KryptonManager.Strings.Cancel; _button2.Text = KryptonManager.Strings.TryAgain; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs index 1e15fa8a0..55ce84318 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs @@ -620,6 +620,7 @@ public void RecalcNonClient() } } +#if NET6_0_OR_GREATER /// Gets or sets the anchoring for minimized MDI children. /// true to anchor minimized MDI children to the bottom left of the parent form; false to anchor to the top left of the parent form. [Category(@"Window Style")] @@ -635,7 +636,8 @@ public void RecalcNonClient() throw new NotSupportedException(@"Please use .NET 6 or newer to use this feature."); } } - #endregion +#endif +#endregion #region Public Chrome ///