From 8f571ed66d36aea635483def021a3f22b6ae1c9d Mon Sep 17 00:00:00 2001 From: Smurf-IV Date: Mon, 6 May 2024 10:08:10 +0100 Subject: [PATCH 1/2] - Restore `KryptonMessageBox` back to "Winform Override" simularity - Fix Layout of Single line of MessageBox Text - Fix usage of MessageBox Icons when System type selected - Fix detection of Windows Version(s) - Apply Brackets style #1376 --- .../View Builder/ViewBuilderOutlookBase.cs | 11 +- .../Controls Toolkit/KryptonMessageBox.cs | 517 ++++++------- .../Controls Toolkit/KryptonMessageBoxDep.cs | 10 +- .../Controls Toolkit/KryptonThemeComboBox.cs | 17 +- .../VisualToastNotificationBasicForm.cs | 2 +- ...astNotificationBasicWithProgressBarForm.cs | 2 +- ...isualToastNotificationBasicRtlAwareForm.cs | 2 +- ...icationBasicWithProgressBarRtlAwareForm.cs | 2 +- ...lToastNotificationComboBoxUserInputForm.cs | 4 +- ...lToastNotificationDateTimeUserInputForm.cs | 4 +- ...stNotificationDomainUpDownUserInputForm.cs | 4 +- ...tNotificationMaskedTextBoxUserInputForm.cs | 4 +- ...tNotificationNumericUpDownUserInputForm.cs | 4 +- ...alToastNotificationTextBoxUserInputForm.cs | 4 +- ...ionComboBoxUserInputWithProgressBarForm.cs | 4 +- ...ionDateTimeUserInputWithProgressBarForm.cs | 4 +- ...ionDomianUpDownInputWithProgressBarForm.cs | 4 +- ...onMaskedTextBoxInputWithProgressBarForm.cs | 4 +- ...mericUpDownUserInputWithProgressBarForm.cs | 4 +- ...tionTextBoxUserInputWithProgressBarForm.cs | 4 +- ...tificationDateTimeUserInputRtlAwareForm.cs | 4 +- ...cationDomainUpDownUserInputRtlAwareForm.cs | 4 +- ...ationMaskedTextBoxUserInputRtlAwareForm.cs | 4 +- ...ationNumericUpDownUserInputRtlAwareForm.cs | 4 +- ...otificationTextBoxUserInputRtlAwareForm.cs | 4 +- ...lToastNotificationUserInputRtlAwareForm.cs | 2 +- ...ionUserInputWithProgressBarRtlAwareForm.cs | 2 +- .../VisualMessageBoxRtlAwareForm.Designer.cs | 94 +-- .../RTL Aware/VisualMessageBoxRtlAwareForm.cs | 719 ++---------------- .../VisualMessageBoxRtlAwareFormDep.cs | 42 +- .../VisualMessageBoxForm.Designer.cs | 79 +- .../Controls Visuals/VisualMessageBoxForm.cs | 685 ++--------------- .../VisualMessageBoxFormDep.cs | 41 +- .../Controls Visuals/VisualTaskDialog.cs | 4 +- .../Controls Visuals/VisualTaskDialogForm.cs | 4 +- .../Action Lists/KryptonManagerActionList.cs | 16 +- .../Designers/KryptonManagerDesigner.cs | 15 +- .../Designers/KryptonThemeComboBoxDesigner.cs | 15 +- .../Krypton.Toolkit/General/Definitions.cs | 20 +- .../General/KryptonMessageBoxController.cs | 10 +- .../General/KryptonMessageBoxData.cs | 8 +- .../KryptonDataGridViewTextAndImageColumn.cs | 2 + .../Utilities/GraphicsExtensions.cs | 8 +- .../Krypton.Toolkit/Utilities/IconHelper.cs | 2 +- .../Krypton.Toolkit/Utilities/OSUtilities.cs | 20 +- Source/Krypton Components/TestForm/Main.cs | 6 +- .../TestForm/MessageBoxTest.cs | 6 +- 47 files changed, 604 insertions(+), 1827 deletions(-) diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs index 4a03ff632..8140ddac6 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs @@ -2370,8 +2370,15 @@ private void RecreateView() ViewDrawBorderEdge? buttonEdge = _buttonEdgeLookup?[page]; // Add to the end of the collection - if (buttonEdge != null) _viewLayout.Add(buttonEdge, dockFar); - if (checkButton != null) _viewLayout.Add(checkButton, dockFar); + if (buttonEdge != null) + { + _viewLayout.Add(buttonEdge, dockFar); + } + + if (checkButton != null) + { + _viewLayout.Add(checkButton, dockFar); + } } } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs index 0c2fcee76..2955e6dfc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs @@ -17,6 +17,11 @@ namespace Krypton.Toolkit { /// /// Displays a message box that can contain text, buttons, and symbols that inform and instruct the user. + /// The API's mimic the "legacy ones" from WinForms, with the addition of optional params to + /// - force ShowCtrl + /// - Hide the close button + /// - "displayHelpButton" has been moved in order to not collide with the above options + /// "HelpInfo" is used instead of passing individual elements to the help location(s) /// [ToolboxItem(false)] [DesignerCategory(@"code")] @@ -24,103 +29,91 @@ public static class KryptonMessageBox { #region Public + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// The text to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(string text, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, string.Empty, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + /// /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// /// The text to display in the message box. /// The text to display in the title bar of the message box. default="string.Empty" /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . /// Displays the close button. If null (default), then the close button will be displayed. /// One of the System.Windows.Forms.DialogResult values. public static DialogResult Show(string text, string caption, bool? showCtrlCopy = null, - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, bool? showCloseButton = null) => - ShowCore(null, text, caption, KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.None, - KryptonMessageBoxDefaultButton.Button4, 0, null, showCtrlCopy, - null, null, @"", - contentAreaType, linkAreaCommand, linkLaunchArgument, contentLinkArea, null, - showCloseButton); + ShowCore(null, text, caption, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + /// /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . /// Displays the close button. If null (default), then the close button will be displayed. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(string text, bool? showCtrlCopy = null, - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? showCloseButton = null) => - ShowCore(null, text, @"", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.None, - KryptonMessageBoxDefaultButton.Button4, 0, - null, showCtrlCopy, false, null, @"", - contentAreaType, linkAreaCommand, linkLaunchArgument, - contentLinkArea, null, showCloseButton); + public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// - /// Displays a message box in front+center of the specified object and with the specified text, caption, buttons, icon, default button, and options. + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// - /// Owner of the modal dialog box. /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . /// Displays the close button. If null (default), then the close button will be displayed. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(IWin32Window? owner, string text, bool? showCtrlCopy = null, - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? showCloseButton = null) => - ShowCore(owner, text, @"", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.None, - KryptonMessageBoxDefaultButton.Button4, 0, null, showCtrlCopy, - false, - null, @"", - contentAreaType, linkAreaCommand, linkLaunchArgument, contentLinkArea, - null, showCloseButton); + public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, KryptonMessageBoxIcon icon, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, icon, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// - /// Displays a message box in front+center of the specified object and with the specified text, caption, buttons, icon, default button, and options. + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// - /// Owner of the modal dialog box. /// The text to display in the message box. /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(IWin32Window? owner, string? text, string caption, bool? showCtrlCopy = null, - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? showCloseButton = null) => - ShowCore(owner, text, caption, KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.None, - KryptonMessageBoxDefaultButton.Button4, 0, null, showCtrlCopy, - false, - null, @"", - contentAreaType, linkAreaCommand, linkLaunchArgument, contentLinkArea, - null, showCloseButton); + public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, icon, defaultButton, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// /// Displays a message box in front+center of the application and with the specified text, caption and buttons. @@ -128,201 +121,223 @@ public static DialogResult Show(IWin32Window? owner, string? text, string captio /// The text to display in the message box. /// The text to display in the title bar of the message box. default="string.Empty" /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. + /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. /// One of the System.Windows.Forms.DialogResult values. public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, - bool? showCtrlCopy = null, - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? showCloseButton = null) => - ShowCore(null, text, caption, buttons, KryptonMessageBoxIcon.None, - KryptonMessageBoxDefaultButton.Button1, 0, - new HelpInfo(@"", 0, null), showCtrlCopy, - null, null, @"", - contentAreaType, linkAreaCommand, linkLaunchArgument, - contentLinkArea, null, - showCloseButton); + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// - /// Displays a message box in front+center of the application and with the specified text, caption, buttons, icon, default button, and options. + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// /// The text to display in the message box. /// The text to display in the title bar of the message box. default="string.Empty" /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. - /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. - /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. - /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. - /// Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Displays a 'Help' button, as seen in .NET 6 and higher. - /// The image of the application. - /// The application path. To be used in conjunction with type. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . - /// If set to true, the will use standard operating system icons. /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. + /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. + /// Contains the help data of the . /// One of the System.Windows.Forms.DialogResult values. public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, - KryptonMessageBoxIcon icon, - KryptonMessageBoxDefaultButton defaultButton = KryptonMessageBoxDefaultButton.Button4, - MessageBoxOptions options = 0, bool displayHelpButton = false, - bool? showCtrlCopy = null, bool? showHelpButton = null, - ProcessStartInfo? linkLaunchArgument = null, Image? applicationImage = null, - string applicationPath = @"", - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - LinkArea? contentLinkArea = null, - bool? forceUseOfOperatingSystemIcons = null, - bool? showCloseButton = null) - => - ShowCore(null, text, caption, buttons, icon, defaultButton, options, - displayHelpButton ? new HelpInfo() : null, showCtrlCopy, - showHelpButton, applicationImage, applicationPath, - contentAreaType, linkAreaCommand, linkLaunchArgument, - contentLinkArea, forceUseOfOperatingSystemIcons, showCloseButton); + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, HelpInfo helpInfo, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// Displays a 'Help' button, as seen in .NET 6 and higher. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. + /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, bool displayHelpButton, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + showHelpButton: displayHelpButton, + showCloseButton: showCloseButton); + + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. + /// The text to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(IWin32Window owner, string text, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(null, text, string.Empty, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. + /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(IWin32Window owner, string? text, string? caption, bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + + + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. + /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// - /// Displays a message box in front+center of the specified object and with the specified text, caption, buttons, icon, default button, and options. + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// /// Owner of the modal dialog box. /// The text to display in the message box. - /// The text to display in the title bar of the message box. default="string.Empty" + /// The text to display in the title bar of the message box. default="string.Empty" /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. - /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. - /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. - /// Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Displays a 'Help' button, as seen in .NET 6 and higher. - /// The image of the application. - /// The application path. To be used in conjunction with type. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . - /// If set to true, the will use standard operating system icons. /// Displays the close button. If null (default), then the close button will be displayed. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(IWin32Window? owner, string text, string caption, - KryptonMessageBoxButtons buttons, KryptonMessageBoxIcon icon, - KryptonMessageBoxDefaultButton defaultButton = KryptonMessageBoxDefaultButton.Button4, - MessageBoxOptions options = 0, bool displayHelpButton = false, - bool? showCtrlCopy = null, bool? showHelpButton = null, Image? applicationImage = null, - string applicationPath = @"", - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? forceUseOfOperatingSystemIcons = null, - bool? showCloseButton = null) - => - ShowCore(owner, text, caption, buttons, icon, defaultButton, options, - displayHelpButton ? new HelpInfo() : null, showCtrlCopy, - showHelpButton, applicationImage, applicationPath, - contentAreaType, linkAreaCommand, linkLaunchArgument, - contentLinkArea, forceUseOfOperatingSystemIcons, - showCloseButton); + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, KryptonMessageBoxIcon icon, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, icon, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. /// The text to display in the message box. - /// The text to display in the title bar of the message box. default="string.Empty" - /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. - /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. - /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. - /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. - /// The path and name of the Help file to display when the user clicks the Help button. - /// One of the System.Windows.Forms.HelpNavigator values. - /// The numeric ID of the Help topic to display when the user clicks the Help button. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Displays a 'Help' button, as seen in .NET 6 and higher. - /// The image of the application. - /// The application path. To be used in conjunction with type. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . - /// If set to true, the will use standard operating system icons. /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(string text, string caption, KryptonMessageBoxButtons buttons, - KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, - MessageBoxOptions options, string helpFilePath, - HelpNavigator navigator, object? param, bool? showCtrlCopy = null, - bool? showHelpButton = null, - Image? applicationImage = null, string applicationPath = @"", - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? forceUseOfOperatingSystemIcons = null, - bool? showCloseButton = null) - => ShowCore(null, text, caption, buttons, icon, defaultButton, options, - new HelpInfo(helpFilePath, navigator, param), showCtrlCopy, - showHelpButton, applicationImage, applicationPath, - contentAreaType, linkAreaCommand, linkLaunchArgument, - contentLinkArea, forceUseOfOperatingSystemIcons, - showCloseButton); + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, icon, defaultButton, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); /// - /// Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator, and Help topic. + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. /// /// Owner of the modal dialog box. /// The text to display in the message box. - /// The text to display in the title bar of the message box. + /// The text to display in the title bar of the message box. default="string.Empty" /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. - /// The path and name of the Help file to display when the user clicks the Help button. - /// One of the System.Windows.Forms.HelpNavigator values. - /// The numeric ID of the Help topic to display when the user clicks the Help button. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + showHelpButton: false, + showCloseButton: showCloseButton); + + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. + /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. /// Show extraText in title. If null (default) then only when Warning or Error icon is used. - /// Displays a 'Help' button, as seen in .NET 6 and higher. - /// The image of the application. - /// The application path. To be used in conjunction with type. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . - /// If set to true, the will use standard operating system icons. /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. + /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. + /// Contains the help data of the . /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(IWin32Window? owner, string text, string caption, - KryptonMessageBoxButtons buttons, - KryptonMessageBoxIcon icon, - KryptonMessageBoxDefaultButton defaultButton, - MessageBoxOptions options, - string helpFilePath, HelpNavigator navigator, - object? param, bool? showCtrlCopy = null, - bool? showHelpButton = null, - Image? applicationImage = null, - string applicationPath = @"", - MessageBoxContentAreaType? contentAreaType = null, - KryptonCommand? linkAreaCommand = null, - ProcessStartInfo? linkLaunchArgument = null, - LinkArea? contentLinkArea = null, - bool? forceUseOfOperatingSystemIcons = null, - bool? showCloseButton = null) - => ShowCore(owner, text, caption, buttons, icon, defaultButton, options, - new HelpInfo(helpFilePath, navigator, param), - showCtrlCopy, showHelpButton, applicationImage, - applicationPath, contentAreaType, linkAreaCommand, - linkLaunchArgument, contentLinkArea, forceUseOfOperatingSystemIcons, showCloseButton); - - /// Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator, and Help topic. - /// The message box data. - /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(KryptonMessageBoxData messageBoxData) => ShowCore(messageBoxData); + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, HelpInfo helpInfo, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + helpInfo: helpInfo, + showCloseButton: showCloseButton); + /// + /// Displays a message box in front+center of the application and with the specified text, caption and buttons. + /// + /// Owner of the modal dialog box. + /// The text to display in the message box. + /// The text to display in the title bar of the message box. default="string.Empty" + /// One of the System.Windows.Forms.KryptonMessageBoxButtons values that specifies which buttons to display in the message box. + /// Displays a 'Help' button, as seen in .NET 6 and higher. + /// One of the KryptonMessageBoxIcon values that specifies which icon to display in the message box. + /// Show extraText in title. If null (default) then only when Warning or Error icon is used. + /// Displays the close button. If null (default), then the close button will be displayed. + /// One of the KryptonMessageBoxDefaultButton values that specifies the default button for the message box. + /// One of the System.Windows.Forms.MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults. + /// One of the System.Windows.Forms.DialogResult values. + public static DialogResult Show(IWin32Window owner, string? text, string? caption, KryptonMessageBoxButtons buttons, bool displayHelpButton, + KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, MessageBoxOptions options, + bool? showCtrlCopy = null, + bool? showCloseButton = null) => + ShowCore(owner, text, caption, buttons, icon, defaultButton, options, + showCtrlCopy: showCtrlCopy, + showHelpButton: displayHelpButton, + showCloseButton: showCloseButton); #endregion #region Implementation @@ -339,30 +354,18 @@ public static DialogResult Show(IWin32Window? owner, string text, string caption /// Contains the help data of the . /// Show extraText in title. If null (default) then only when Warning or Error icon is used. /// Displays a 'Help' button, as seen in .NET 6 and higher. - /// The image of the application. - /// The application path. To be used in conjunction with type. - /// Specifies the . - /// Specifies a if using the type. - /// Specifies the if a has not been defined. - /// Specifies the area within the to be regarded as a link. See . - /// If set to true, the will use standard operating system icons. /// Displays the close button. If null (default), then the close button will be displayed. /// One of the System.Windows.Forms.DialogResult values. private static DialogResult ShowCore(IWin32Window? owner, string? text, string? caption, - KryptonMessageBoxButtons buttons, - KryptonMessageBoxIcon icon, - KryptonMessageBoxDefaultButton defaultButton, - MessageBoxOptions options, - HelpInfo? helpInfo, bool? showCtrlCopy, - bool? showHelpButton, - Image? applicationImage, string? applicationPath, - MessageBoxContentAreaType? contentAreaType, - KryptonCommand? linkLabelCommand, - ProcessStartInfo? linkLaunchArgument, - LinkArea? contentLinkArea, - bool? forceUseOfOperatingSystemIcons, - bool? showCloseButton) + KryptonMessageBoxButtons buttons = KryptonMessageBoxButtons.OK, + KryptonMessageBoxIcon icon = KryptonMessageBoxIcon.None, + KryptonMessageBoxDefaultButton defaultButton = KryptonMessageBoxDefaultButton.Button4, + MessageBoxOptions options = 0, + HelpInfo? helpInfo = null, + bool? showCtrlCopy = null, + bool? showHelpButton = null, + bool? showCloseButton = null) { caption = string.IsNullOrEmpty(caption) ? @" " : caption; @@ -372,47 +375,17 @@ private static DialogResult ShowCore(IWin32Window? owner, if (options is MessageBoxOptions.RightAlign or MessageBoxOptions.RtlReading) { - using var kmbrtl = new VisualMessageBoxRtlAwareForm(showOwner, text, caption, buttons, icon, - defaultButton, helpInfo, showCtrlCopy, showHelpButton, applicationImage, applicationPath, - contentAreaType, linkLabelCommand, - linkLaunchArgument, contentLinkArea, - forceUseOfOperatingSystemIcons, showCloseButton); + using var kmbRtl = new VisualMessageBoxRtlAwareForm(showOwner, text, caption, buttons, icon, + defaultButton, helpInfo, showCtrlCopy, showHelpButton, showCloseButton); - kmbrtl.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; + kmbRtl.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; - return kmbrtl.ShowDialog(showOwner); + return kmbRtl.ShowDialog(showOwner); } else { using var kmb = new VisualMessageBoxForm(showOwner, text, caption, buttons, icon, - defaultButton, helpInfo, showCtrlCopy, showHelpButton, applicationImage, applicationPath, - contentAreaType, linkLabelCommand, - linkLaunchArgument, contentLinkArea, - forceUseOfOperatingSystemIcons, showCloseButton); - - kmb.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; - - return kmb.ShowDialog(showOwner); - } - } - - private static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) - { - messageBoxData.Caption = string.IsNullOrEmpty(messageBoxData.Caption) ? @" " : messageBoxData.Caption; - - IWin32Window? showOwner = ValidateOptions(messageBoxData.Owner, messageBoxData.Options, messageBoxData.HelpInfo); - - if (messageBoxData.Options is MessageBoxOptions.RightAlign or MessageBoxOptions.RtlReading) - { - using var kmbrtl = new VisualMessageBoxRtlAwareForm(messageBoxData); - - kmbrtl.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; - - return kmbrtl.ShowDialog(showOwner); - } - else - { - using var kmb = new VisualMessageBoxForm(messageBoxData); + defaultButton, helpInfo, showCtrlCopy, showHelpButton, showCloseButton); kmb.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; @@ -448,7 +421,7 @@ private static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) if ((helpInfo != null) || ((options & (MessageBoxOptions.ServiceNotification | MessageBoxOptions.DefaultDesktopOnly)) == 0)) { - // If do not have an owner passed in? then get the active window and use that instead + // If this does not have an owner passed in? then get the active window and use that instead showOwner = owner ?? Control.FromHandle(PI.GetActiveWindow()); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBoxDep.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBoxDep.cs index 0c58cde31..e599ec050 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBoxDep.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBoxDep.cs @@ -1,11 +1,7 @@ #region BSD License /* - * - * Original BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE) - * © Component Factory Pty Ltd, 2006 - 2016, (Version 4.5.0.0) All rights reserved. - * * New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE) - * Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2024. All rights reserved. + * Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2024 - 2024. All rights reserved. * */ #endregion @@ -321,7 +317,7 @@ public static DialogResult Show(IWin32Window? owner, string text, string caption /// Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator, and Help topic. /// The message box data. /// One of the System.Windows.Forms.DialogResult values. - public static DialogResult Show(KryptonMessageBoxData messageBoxData) => ShowCore(messageBoxData); + public static DialogResult Show(KryptonMessageBoxDataDep messageBoxData) => ShowCore(messageBoxData); #endregion @@ -396,7 +392,7 @@ private static DialogResult ShowCore(IWin32Window? owner, } } - private static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) + private static DialogResult ShowCore(KryptonMessageBoxDataDep messageBoxData) { messageBoxData.Caption = string.IsNullOrEmpty(messageBoxData.Caption) ? @" " : messageBoxData.Caption; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs index 6284a2635..dc682ac47 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonThemeComboBox.cs @@ -58,7 +58,11 @@ public PaletteMode DefaultPalette set { - if (_defaultPalette == value) return; + if (_defaultPalette == value) + { + return; + } + if (_handleCreated) { // Safe to directly access UI thread now @@ -149,7 +153,10 @@ public KryptonThemeComboBox() private void KryptonThemeComboBox_HandleCreated(object sender, EventArgs e) { _handleCreated = true; - if (!_pendingPaletteUpdate) return; + if (!_pendingPaletteUpdate) + { + return; + } _pendingPaletteUpdate = false; DefaultPalette = _pendingPaletteMode; @@ -157,7 +164,11 @@ private void KryptonThemeComboBox_HandleCreated(object sender, EventArgs e) private void UpdateDefaultPaletteIndex(PaletteMode mode) { - if (_isUpdating) return; + if (_isUpdating) + { + return; + } + _isUpdating = true; var selectedText = ThemeManager.ReturnPaletteModeAsString(mode); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicForm.cs index 7964cc004..1faad1a0e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicForm.cs @@ -149,7 +149,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicWithProgressBarForm.cs index e58911058..7f11920ea 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Left to Right/VisualToastNotificationBasicWithProgressBarForm.cs @@ -145,7 +145,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicRtlAwareForm.cs index c2a46a6ce..f9dc5d921 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicRtlAwareForm.cs @@ -145,7 +145,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicWithProgressBarRtlAwareForm.cs index 45a7c0510..3083c8ed3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/Basic/Right to Left/VisualToastNotificationBasicWithProgressBarRtlAwareForm.cs @@ -145,7 +145,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationComboBoxUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationComboBoxUserInputForm.cs index beeb49518..4b3f401d1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationComboBoxUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationComboBoxUserInputForm.cs @@ -128,7 +128,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -142,7 +142,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDateTimeUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDateTimeUserInputForm.cs index 7f5633639..4248665ad 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDateTimeUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDateTimeUserInputForm.cs @@ -127,7 +127,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -141,7 +141,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDomainUpDownUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDomainUpDownUserInputForm.cs index 82c1e834b..90a148610 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDomainUpDownUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationDomainUpDownUserInputForm.cs @@ -147,7 +147,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -161,7 +161,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationMaskedTextBoxUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationMaskedTextBoxUserInputForm.cs index f6ff09e20..ed8be5143 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationMaskedTextBoxUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationMaskedTextBoxUserInputForm.cs @@ -119,7 +119,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -133,7 +133,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationNumericUpDownUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationNumericUpDownUserInputForm.cs index f4f2a9b1b..a1fb90220 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationNumericUpDownUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationNumericUpDownUserInputForm.cs @@ -123,7 +123,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -137,7 +137,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationTextBoxUserInputForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationTextBoxUserInputForm.cs index ccef5c72d..446bac35f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationTextBoxUserInputForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/Normal/VisualToastNotificationTextBoxUserInputForm.cs @@ -145,7 +145,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -159,7 +159,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarForm.cs index 3e5bf4502..25f5aae63 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarForm.cs @@ -130,7 +130,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -144,7 +144,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarForm.cs index fd501140d..3be9478aa 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarForm.cs @@ -129,7 +129,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -143,7 +143,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarForm.cs index 91f561a0c..99ef5ffbb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarForm.cs @@ -129,7 +129,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -143,7 +143,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarForm.cs index e0ab48d9f..f11331029 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarForm.cs @@ -121,7 +121,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -135,7 +135,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarForm.cs index c40f639ee..728146e5e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarForm.cs @@ -125,7 +125,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -139,7 +139,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarForm.cs index 57a9d0a78..8e96be667 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Left to Right/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarForm.cs @@ -126,7 +126,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -140,7 +140,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDateTimeUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDateTimeUserInputRtlAwareForm.cs index 16a9c14c8..d2467380d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDateTimeUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDateTimeUserInputRtlAwareForm.cs @@ -125,7 +125,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -139,7 +139,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDomainUpDownUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDomainUpDownUserInputRtlAwareForm.cs index 7456991ab..8085b8e39 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDomainUpDownUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationDomainUpDownUserInputRtlAwareForm.cs @@ -138,7 +138,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -152,7 +152,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationMaskedTextBoxUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationMaskedTextBoxUserInputRtlAwareForm.cs index 2b944b796..c7c6562c1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationMaskedTextBoxUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationMaskedTextBoxUserInputRtlAwareForm.cs @@ -121,7 +121,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -135,7 +135,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationNumericUpDownUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationNumericUpDownUserInputRtlAwareForm.cs index 04c8928af..b6d8b40b5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationNumericUpDownUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationNumericUpDownUserInputRtlAwareForm.cs @@ -125,7 +125,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -139,7 +139,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationTextBoxUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationTextBoxUserInputRtlAwareForm.cs index 8f2da15ab..8771a647d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationTextBoxUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/Normal/VisualToastNotificationTextBoxUserInputRtlAwareForm.cs @@ -143,7 +143,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -157,7 +157,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputRtlAwareForm.cs index 0718cded1..32f83b831 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputRtlAwareForm.cs @@ -147,7 +147,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputWithProgressBarRtlAwareForm.cs index 48ce0f13c..45b1a2aee 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/VisualToastNotificationUserInputWithProgressBarRtlAwareForm.cs @@ -145,7 +145,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.Designer.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.Designer.cs index a04a5b112..82a456027 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.Designer.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.Designer.cs @@ -38,8 +38,7 @@ private void InitializeComponent() this._button2 = new Krypton.Toolkit.MessageButton(); this._messageIcon = new System.Windows.Forms.PictureBox(); this.kpnlContentArea = new Krypton.Toolkit.KryptonPanel(); - this.kwlblMessageText = new Krypton.Toolkit.KryptonWrapLabel(); - this.klwlblMessageText = new Krypton.Toolkit.KryptonLinkWrapLabel(); + this.kwlblMessageText = new Krypton.Toolkit.KryptonTextBox(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit(); this.kryptonPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); @@ -55,9 +54,9 @@ private void InitializeComponent() this.kryptonPanel1.Controls.Add(this.tableLayoutPanel1); this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonPanel1.Location = new System.Drawing.Point(0, 0); - this.kryptonPanel1.Margin = new System.Windows.Forms.Padding(2); + this.kryptonPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.kryptonPanel1.Name = "kryptonPanel1"; - this.kryptonPanel1.Size = new System.Drawing.Size(219, 124); + this.kryptonPanel1.Size = new System.Drawing.Size(292, 81); this.kryptonPanel1.TabIndex = 2; // // tableLayoutPanel1 @@ -71,13 +70,13 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.kpnlContentArea, 1, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(219, 124); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(292, 81); this.tableLayoutPanel1.TabIndex = 0; // // _panelButtons @@ -89,11 +88,11 @@ private void InitializeComponent() this._panelButtons.Controls.Add(this._button1); this._panelButtons.Controls.Add(this._button2); this._panelButtons.Dock = System.Windows.Forms.DockStyle.Fill; - this._panelButtons.Location = new System.Drawing.Point(0, 103); + this._panelButtons.Location = new System.Drawing.Point(0, 55); this._panelButtons.Margin = new System.Windows.Forms.Padding(0); this._panelButtons.Name = "_panelButtons"; this._panelButtons.PanelBackStyle = Krypton.Toolkit.PaletteBackStyle.PanelAlternate; - this._panelButtons.Size = new System.Drawing.Size(219, 21); + this._panelButtons.Size = new System.Drawing.Size(292, 26); this._panelButtons.TabIndex = 0; // // _borderEdge @@ -101,9 +100,9 @@ private void InitializeComponent() this._borderEdge.BorderStyle = Krypton.Toolkit.PaletteBorderStyle.HeaderPrimary; this._borderEdge.Dock = System.Windows.Forms.DockStyle.Top; this._borderEdge.Location = new System.Drawing.Point(0, 0); - this._borderEdge.Margin = new System.Windows.Forms.Padding(2); + this._borderEdge.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this._borderEdge.Name = "_borderEdge"; - this._borderEdge.Size = new System.Drawing.Size(219, 1); + this._borderEdge.Size = new System.Drawing.Size(292, 1); this._borderEdge.Text = "kryptonBorderEdge1"; // // _button4 @@ -112,11 +111,11 @@ private void InitializeComponent() this._button4.AutoSize = true; this._button4.Enabled = false; this._button4.IgnoreAltF4 = false; - this._button4.Location = new System.Drawing.Point(219, 0); + this._button4.Location = new System.Drawing.Point(292, 0); this._button4.Margin = new System.Windows.Forms.Padding(0); - this._button4.MinimumSize = new System.Drawing.Size(38, 21); + this._button4.MinimumSize = new System.Drawing.Size(51, 26); this._button4.Name = "_button4"; - this._button4.Size = new System.Drawing.Size(38, 23); + this._button4.Size = new System.Drawing.Size(51, 32); this._button4.TabIndex = 2; this._button4.Values.Text = "B4"; this._button4.Visible = false; @@ -127,11 +126,11 @@ private void InitializeComponent() this._button3.AutoSize = true; this._button3.Enabled = false; this._button3.IgnoreAltF4 = false; - this._button3.Location = new System.Drawing.Point(182, 0); + this._button3.Location = new System.Drawing.Point(243, 0); this._button3.Margin = new System.Windows.Forms.Padding(0); - this._button3.MinimumSize = new System.Drawing.Size(38, 21); + this._button3.MinimumSize = new System.Drawing.Size(51, 26); this._button3.Name = "_button3"; - this._button3.Size = new System.Drawing.Size(38, 23); + this._button3.Size = new System.Drawing.Size(51, 32); this._button3.TabIndex = 2; this._button3.Values.Text = "B3"; this._button3.Visible = false; @@ -142,11 +141,11 @@ private void InitializeComponent() this._button1.AutoSize = true; this._button1.Enabled = false; this._button1.IgnoreAltF4 = false; - this._button1.Location = new System.Drawing.Point(106, 0); + this._button1.Location = new System.Drawing.Point(141, 0); this._button1.Margin = new System.Windows.Forms.Padding(0); - this._button1.MinimumSize = new System.Drawing.Size(38, 21); + this._button1.MinimumSize = new System.Drawing.Size(51, 26); this._button1.Name = "_button1"; - this._button1.Size = new System.Drawing.Size(38, 23); + this._button1.Size = new System.Drawing.Size(51, 32); this._button1.TabIndex = 0; this._button1.Values.Text = "B1"; this._button1.Visible = false; @@ -157,11 +156,11 @@ private void InitializeComponent() this._button2.AutoSize = true; this._button2.Enabled = false; this._button2.IgnoreAltF4 = false; - this._button2.Location = new System.Drawing.Point(144, 0); + this._button2.Location = new System.Drawing.Point(192, 0); this._button2.Margin = new System.Windows.Forms.Padding(0); - this._button2.MinimumSize = new System.Drawing.Size(38, 21); + this._button2.MinimumSize = new System.Drawing.Size(51, 26); this._button2.Name = "_button2"; - this._button2.Size = new System.Drawing.Size(38, 23); + this._button2.Size = new System.Drawing.Size(51, 32); this._button2.TabIndex = 1; this._button2.Values.Text = "B2"; this._button2.Visible = false; @@ -170,10 +169,10 @@ private void InitializeComponent() // this._messageIcon.BackColor = System.Drawing.Color.Transparent; this._messageIcon.Dock = System.Windows.Forms.DockStyle.Fill; - this._messageIcon.Location = new System.Drawing.Point(178, 4); - this._messageIcon.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4); + this._messageIcon.Location = new System.Drawing.Point(237, 5); + this._messageIcon.Margin = new System.Windows.Forms.Padding(11, 5, 5, 5); this._messageIcon.Name = "_messageIcon"; - this._messageIcon.Size = new System.Drawing.Size(33, 95); + this._messageIcon.Size = new System.Drawing.Size(44, 45); this._messageIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this._messageIcon.TabIndex = 0; this._messageIcon.TabStop = false; @@ -181,47 +180,36 @@ private void InitializeComponent() // kpnlContentArea // this.kpnlContentArea.Controls.Add(this.kwlblMessageText); - this.kpnlContentArea.Controls.Add(this.klwlblMessageText); this.kpnlContentArea.Dock = System.Windows.Forms.DockStyle.Fill; - this.kpnlContentArea.Location = new System.Drawing.Point(3, 3); + this.kpnlContentArea.Location = new System.Drawing.Point(4, 4); + this.kpnlContentArea.Margin = new System.Windows.Forms.Padding(4); this.kpnlContentArea.Name = "kpnlContentArea"; - this.kpnlContentArea.Size = new System.Drawing.Size(168, 97); + this.kpnlContentArea.Size = new System.Drawing.Size(224, 47); this.kpnlContentArea.TabIndex = 1; // // kwlblMessageText // - this.kwlblMessageText.AutoSize = false; this.kwlblMessageText.Dock = System.Windows.Forms.DockStyle.Fill; - this.kwlblMessageText.Font = new System.Drawing.Font("Segoe UI", 9F); - this.kwlblMessageText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(57)))), ((int)(((byte)(91))))); - this.kwlblMessageText.LabelStyle = Krypton.Toolkit.LabelStyle.AlternateControl; + this.kwlblMessageText.InputControlStyle = Krypton.Toolkit.InputControlStyle.PanelClient; this.kwlblMessageText.Location = new System.Drawing.Point(0, 0); + this.kwlblMessageText.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.kwlblMessageText.Multiline = true; this.kwlblMessageText.Name = "kwlblMessageText"; - this.kwlblMessageText.Size = new System.Drawing.Size(168, 97); - this.kwlblMessageText.Text = "Message Text"; - this.kwlblMessageText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // klwlblMessageText - // - this.klwlblMessageText.AutoSize = false; - this.klwlblMessageText.Dock = System.Windows.Forms.DockStyle.Fill; - this.klwlblMessageText.Font = new System.Drawing.Font("Segoe UI", 9F); - this.klwlblMessageText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(57)))), ((int)(((byte)(91))))); - this.klwlblMessageText.LabelStyle = Krypton.Toolkit.LabelStyle.AlternateControl; - this.klwlblMessageText.Location = new System.Drawing.Point(0, 0); - this.klwlblMessageText.Name = "klwlblMessageText"; - this.klwlblMessageText.Size = new System.Drawing.Size(168, 97); - this.klwlblMessageText.Text = "Message Text"; - this.klwlblMessageText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.kwlblMessageText.ReadOnly = true; + this.kwlblMessageText.Size = new System.Drawing.Size(224, 47); + this.kwlblMessageText.StateCommon.Border.DrawBorders = Krypton.Toolkit.PaletteDrawBorders.None; + this.kwlblMessageText.TabIndex = 0; + this.kwlblMessageText.Text = "Message Text\r\n.\ttabbed"; // // VisualMessageBoxRtlAwareForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(219, 124); + this.ClientSize = new System.Drawing.Size(292, 81); this.Controls.Add(this.kryptonPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.KeyPreview = true; + this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "VisualMessageBoxRtlAwareForm"; @@ -239,6 +227,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this._messageIcon)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.kpnlContentArea)).EndInit(); this.kpnlContentArea.ResumeLayout(false); + this.kpnlContentArea.PerformLayout(); this.ResumeLayout(false); } @@ -255,7 +244,6 @@ private void InitializeComponent() private MessageButton _button2; private PictureBox _messageIcon; private KryptonPanel kpnlContentArea; - private KryptonLinkWrapLabel klwlblMessageText; - private KryptonWrapLabel kwlblMessageText; + private KryptonTextBox kwlblMessageText; } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.cs index 43565c6a5..f3e6e82a0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareForm.cs @@ -16,14 +16,8 @@ internal partial class VisualMessageBoxRtlAwareForm : KryptonForm private readonly bool _showHelpButton; private readonly string? _text; private readonly string? _caption; - private readonly string _applicationPath; private readonly KryptonMessageBoxButtons _buttons; private readonly KryptonMessageBoxIcon _kryptonMessageBoxIcon; - private readonly Image? _applicationImage; - private readonly bool? _forceUseOfOperatingSystemIcons; - private readonly KryptonMessageBoxData _messageBoxData; - private readonly bool? _showCloseButton; - private readonly KryptonMessageBoxDefaultButton _defaultButton; //private readonly MessageBoxOptions _options; // https://github.com/Krypton-Suite/Standard-Toolkit/issues/313 @@ -31,24 +25,11 @@ internal partial class VisualMessageBoxRtlAwareForm : KryptonForm private readonly IWin32Window? _showOwner; private readonly HelpInfo? _helpInfo; - // For the LinkLabel option - private readonly MessageBoxContentAreaType? _contentAreaType; - private readonly KryptonCommand? _linkLabelCommand; - private readonly ProcessStartInfo? _linkLaunchArgument; - private readonly LinkArea _contentLinkArea; - - private KryptonMessageBoxResult _messageBoxResult; - #endregion #region Public - public KryptonMessageBoxResult MessageBoxResult - { - get => _messageBoxResult; - - set => _messageBoxResult = value; - } + public KryptonMessageBoxResult MessageBoxResult { get; set; } #endregion @@ -65,17 +46,15 @@ public VisualMessageBoxRtlAwareForm(IWin32Window? showOwner, string? text, strin KryptonMessageBoxDefaultButton defaultButton, HelpInfo? helpInfo, bool? showCtrlCopy, bool? showHelpButton, - Image? applicationImage, - string? applicationPath, - MessageBoxContentAreaType? contentAreaType, - KryptonCommand? linkLabelCommand, - ProcessStartInfo? linkLaunchArgument, - LinkArea? contentLinkArea, - bool? forceUseOfOperatingSystemIcons, bool? showCloseButton) { // Store incoming values - _text = text; + if (text != null && !text.Contains('\n')) + { + _text = "\r\n"; // \n means that the single line text should align with the icon + } + + _text += text; _caption = caption; _buttons = buttons; _kryptonMessageBoxIcon = icon; @@ -83,16 +62,6 @@ public VisualMessageBoxRtlAwareForm(IWin32Window? showOwner, string? text, strin _helpInfo = helpInfo; _showOwner = showOwner; _showHelpButton = showHelpButton ?? (helpInfo != null); - _applicationImage = applicationImage; - _applicationPath = applicationPath ?? string.Empty; - _contentAreaType = contentAreaType ?? MessageBoxContentAreaType.Normal; - _linkLabelCommand = linkLabelCommand ?? new KryptonCommand(); - _contentLinkArea = string.IsNullOrEmpty(text) - ? new LinkArea(0, 0) - : contentLinkArea ?? new LinkArea(0, text.Length); - _linkLaunchArgument = linkLaunchArgument ?? new ProcessStartInfo(); - _forceUseOfOperatingSystemIcons = forceUseOfOperatingSystemIcons ?? false; - _showCloseButton = showCloseButton ?? true; // Create the form contents InitializeComponent(); @@ -104,74 +73,21 @@ public VisualMessageBoxRtlAwareForm(IWin32Window? showOwner, string? text, strin UpdateDefault(); UpdateHelp(); UpdateTextExtra(showCtrlCopy); - UpdateContentAreaType(contentAreaType); - UpdateContentLinkArea(contentLinkArea); - // Finally calculate and set form sizing UpdateSizing(showOwner); ShowCloseButton(showCloseButton); } - - public VisualMessageBoxRtlAwareForm(KryptonMessageBoxData messageBoxData) - { - _messageBoxData = messageBoxData; - - InitializeComponent(); - - // Update contents to match requirements - UpdateText(_messageBoxData.Caption, _messageBoxData.MessageText, _messageBoxData.MessageContentAreaType); - UpdateIcon(_messageBoxData.Icon); - UpdateButtons(_messageBoxData.Buttons); - UpdateDefault(_messageBoxData.DefaultButton); - UpdateHelp(_messageBoxData.ShowHelpButton); - UpdateTextExtra(_messageBoxData.ShowCtrlCopy); - UpdateContentAreaType(_messageBoxData.MessageContentAreaType); - UpdateContentLinkArea(_messageBoxData.ContentLinkArea); - - ShowCloseButton(_messageBoxData.ShowCloseButton); - - // Finally calculate and set form sizing - UpdateSizing(_messageBoxData.Owner); - } - #endregion #region Implementation - private void UpdateText(string caption, string? text, MessageBoxContentAreaType? contentAreaType) - { - // Set the text of the form - Text = string.IsNullOrEmpty(caption) ? string.Empty : caption.Split(Environment.NewLine.ToCharArray())[0]; - - switch (contentAreaType) - { - case MessageBoxContentAreaType.Normal: - kwlblMessageText.Text = text; - break; - case MessageBoxContentAreaType.LinkLabel: - klwlblMessageText.Text = text; - break; - case null: - kwlblMessageText.Text = text; - break; - default: - throw new ArgumentOutOfRangeException(nameof(contentAreaType), contentAreaType, null); - } - } - private void UpdateText() { - Text = string.IsNullOrEmpty(_caption) ? string.Empty : _caption.Split(Environment.NewLine.ToCharArray())[0]; - - if (_contentAreaType == MessageBoxContentAreaType.Normal) - { - kwlblMessageText.Text = _text; - } - else - { - klwlblMessageText.Text = _text; - } + Text = string.IsNullOrEmpty(_caption) + ? string.Empty + : _caption!.Split(Environment.NewLine.ToCharArray())[0]; + kwlblMessageText.Text = _text; } private void UpdateTextExtra(bool? showCtrlCopy) @@ -193,102 +109,27 @@ private void UpdateTextExtra(bool? showCtrlCopy) } } - private void UpdateIcon(KryptonMessageBoxIcon icon) + private void UpdateIcon() { - if (OSUtilities.IsWindowsEleven) - { - switch (icon) - { - case KryptonMessageBoxIcon.None: - // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; - case KryptonMessageBoxIcon.Hand: - _messageIcon.Image = MessageBoxImageResources.GenericHand; - SystemSounds.Hand.Play(); - break; - case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; - SystemSounds.Question.Play(); - break; - case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Stop: - _messageIcon.Image = MessageBoxImageResources.GenericStop; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Error: - _messageIcon.Image = MessageBoxImageResources.Critical_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Warning: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Information: - _messageIcon.Image = MessageBoxImageResources.Information_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Shield: - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - break; - case KryptonMessageBoxIcon.WindowsLogo: - _messageIcon.Image = MessageBoxImageResources.Windows11; - break; - case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) - { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); - Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - } - break; - case KryptonMessageBoxIcon.SystemApplication: - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - break; - } - } - else + if (OSUtilities.IsAtLeastWindowsEleven) { - switch (icon) + switch (_kryptonMessageBoxIcon) { case KryptonMessageBoxIcon.None: // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; case KryptonMessageBoxIcon.Hand: _messageIcon.Image = MessageBoxImageResources.GenericHand; SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.SystemHand: + //case KryptonMessageBoxIcon.SystemStop: + //case KryptonMessageBoxIcon.SystemError: _messageIcon.Image = SystemIcons.Hand.ToBitmap(); SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.GenericQuestion; + _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; SystemSounds.Question.Play(); break; case KryptonMessageBoxIcon.SystemQuestion: @@ -296,7 +137,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Question.Play(); break; case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.GenericWarning; + _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.SystemExclamation: @@ -304,9 +145,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven - ? MessageBoxImageResources.Asterisk_Windows_11 - : MessageBoxImageResources.GenericAsterisk; + _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.SystemAsterisk: @@ -317,113 +156,6 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) _messageIcon.Image = MessageBoxImageResources.GenericStop; SystemSounds.Asterisk.Play(); break; - case KryptonMessageBoxIcon.Error: - _messageIcon.Image = MessageBoxImageResources.GenericCritical; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Warning: - _messageIcon.Image = MessageBoxImageResources.GenericWarning; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Information: - _messageIcon.Image = MessageBoxImageResources.GenericInformation; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - } - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_10; - } - else - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_7; - } - - break; - case KryptonMessageBoxIcon.WindowsLogo: - // Because Windows 11 displays a generic application icon, - // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = MessageBoxImageResources.Windows11; - } - // Windows 10 - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = MessageBoxImageResources.Windows_8_and_10_Logo; - } - else - { - _messageIcon.Image = SystemIcons.WinLogo.ToBitmap(); - } - - break; - case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) - { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath) - ?.ToBitmap(); - Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - } - - break; - case KryptonMessageBoxIcon.SystemApplication: - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - break; - } - } - - _messageIcon.Visible = (_kryptonMessageBoxIcon != KryptonMessageBoxIcon.None); - } - - private void UpdateIcon() - { - if (OSUtilities.IsWindowsEleven) - { - switch (_kryptonMessageBoxIcon) - { - case KryptonMessageBoxIcon.None: - // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; - case KryptonMessageBoxIcon.Hand: - _messageIcon.Image = MessageBoxImageResources.GenericHand; - SystemSounds.Hand.Play(); - break; - case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; - SystemSounds.Question.Play(); - break; - case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Stop: - _messageIcon.Image = MessageBoxImageResources.GenericStop; - SystemSounds.Asterisk.Play(); - break; case KryptonMessageBoxIcon.Error: _messageIcon.Image = MessageBoxImageResources.Critical_Windows_11; SystemSounds.Asterisk.Play(); @@ -440,24 +172,18 @@ private void UpdateIcon() _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; break; case KryptonMessageBoxIcon.WindowsLogo: + // Because Windows 11 displays a generic application icon, + // we need to rely on an image instead _messageIcon.Image = MessageBoxImageResources.Windows11; break; case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); + var applicationPath = Application.ExecutablePath; + Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(applicationPath)?.ToBitmap(); Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); + _messageIcon.Image = scaledImage ?? + // Fall back to defaults + SystemIcons.Application.ToBitmap(); } break; case KryptonMessageBoxIcon.SystemApplication: @@ -471,16 +197,14 @@ private void UpdateIcon() { case KryptonMessageBoxIcon.None: // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } break; case KryptonMessageBoxIcon.Hand: _messageIcon.Image = MessageBoxImageResources.GenericHand; SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.SystemHand: + //case KryptonMessageBoxIcon.SystemStop: + //case KryptonMessageBoxIcon.SystemError: _messageIcon.Image = SystemIcons.Hand.ToBitmap(); SystemSounds.Hand.Play(); break; @@ -501,9 +225,7 @@ private void UpdateIcon() SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven - ? MessageBoxImageResources.Asterisk_Windows_11 - : MessageBoxImageResources.GenericAsterisk; + _messageIcon.Image = MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.SystemAsterisk: @@ -527,52 +249,23 @@ private void UpdateIcon() SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - } - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_10; - } - else - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_7; - } + _messageIcon.Image = OSUtilities.IsWindowsTen + ? UACShieldIconResources.UAC_Shield_Windows_10 + : UACShieldIconResources.UAC_Shield_Windows_7; break; case KryptonMessageBoxIcon.WindowsLogo: - // Because Windows 11 displays a generic application icon, - // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = MessageBoxImageResources.Windows11; - } - // Windows 10 - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = MessageBoxImageResources.Windows_8_and_10_Logo; - } - else - { - _messageIcon.Image = SystemIcons.WinLogo.ToBitmap(); - } + _messageIcon.Image = OSUtilities.IsWindowsTen + ? MessageBoxImageResources.Windows_8_and_10_Logo + : SystemIcons.WinLogo.ToBitmap(); break; case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); + var applicationPath = Application.ExecutablePath; + Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(applicationPath)?.ToBitmap(); Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); + _messageIcon.Image = scaledImage ?? + // Fall back to defaults + SystemIcons.Application.ToBitmap(); } break; case KryptonMessageBoxIcon.SystemApplication: @@ -580,9 +273,7 @@ private void UpdateIcon() break; } } - _messageIcon.Visible = (_kryptonMessageBoxIcon != KryptonMessageBoxIcon.None); - } private void UpdateButtons() @@ -595,107 +286,7 @@ private void UpdateButtons() _button1.Visible = true; _button1.Enabled = true; break; - case KryptonMessageBoxButtons.OKCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.OK; - _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button1.DialogResult = DialogResult.OK; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case KryptonMessageBoxButtons.YesNo: - _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; - _button2.Text = KryptonManager.Strings.GeneralStrings.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 KryptonMessageBoxButtons.YesNoCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; - _button2.Text = KryptonManager.Strings.GeneralStrings.No; - _button3.Text = KryptonManager.Strings.GeneralStrings.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 KryptonMessageBoxButtons.RetryCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.Retry; - _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button1.DialogResult = DialogResult.Retry; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case KryptonMessageBoxButtons.AbortRetryIgnore: - _button1.Text = KryptonManager.Strings.GeneralStrings.Abort; - _button2.Text = KryptonManager.Strings.GeneralStrings.Retry; - _button3.Text = KryptonManager.Strings.GeneralStrings.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; - case KryptonMessageBoxButtons.CancelTryContinue: - _button1.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button2.Text = KryptonManager.Strings.GeneralStrings.TryAgain; - _button3.Text = KryptonManager.Strings.GeneralStrings.Continue; - _button1.DialogResult = DialogResult.Cancel; -#if NET6_0_OR_GREATER - _button2.DialogResult = DialogResult.TryAgain; - _button3.DialogResult = DialogResult.Continue; -#else - _button2.DialogResult = (DialogResult)10; - _button3.DialogResult = (DialogResult)11; -#endif - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - _button3.Visible = true; - _button3.Enabled = true; - break; - } - // Do we ignore the Alt+F4 on the buttons? - if (!ControlBox) - { - _button1.IgnoreAltF4 = true; - _button2.IgnoreAltF4 = true; - _button3.IgnoreAltF4 = true; - _button4.IgnoreAltF4 = true; - } - } - - private void UpdateButtons(KryptonMessageBoxButtons buttons) - { - switch (buttons) - { - case KryptonMessageBoxButtons.OK: - _button1.Text = KryptonManager.Strings.GeneralStrings.OK; - _button1.DialogResult = DialogResult.OK; - _button1.Visible = true; - _button1.Enabled = true; - break; case KryptonMessageBoxButtons.OKCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.OK; _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; @@ -706,6 +297,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Visible = true; _button2.Enabled = true; break; + case KryptonMessageBoxButtons.YesNo: _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; _button2.Text = KryptonManager.Strings.GeneralStrings.No; @@ -717,6 +309,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Enabled = true; ControlBox = false; break; + case KryptonMessageBoxButtons.YesNoCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; _button2.Text = KryptonManager.Strings.GeneralStrings.No; @@ -731,6 +324,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button3.Visible = true; _button3.Enabled = true; break; + case KryptonMessageBoxButtons.RetryCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.Retry; _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; @@ -741,6 +335,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Visible = true; _button2.Enabled = true; break; + case KryptonMessageBoxButtons.AbortRetryIgnore: _button1.Text = KryptonManager.Strings.GeneralStrings.Abort; _button2.Text = KryptonManager.Strings.GeneralStrings.Retry; @@ -756,6 +351,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button3.Enabled = true; ControlBox = false; break; + case KryptonMessageBoxButtons.CancelTryContinue: _button1.Text = KryptonManager.Strings.GeneralStrings.Cancel; _button2.Text = KryptonManager.Strings.GeneralStrings.TryAgain; @@ -787,34 +383,6 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) } } - private void UpdateDefault(KryptonMessageBoxDefaultButton? defaultButton) - { - switch (defaultButton) - { - case KryptonMessageBoxDefaultButton.Button1: - //_button1.Select(); - AcceptButton = _button1; - break; - case KryptonMessageBoxDefaultButton.Button2: - //_button2.Select(); - AcceptButton = _button2; - break; - case KryptonMessageBoxDefaultButton.Button3: - //_button3.Select(); - AcceptButton = _button3; - break; - case KryptonMessageBoxDefaultButton.Button4: - AcceptButton = _showHelpButton ? _button4 : _button1; - break; - case null: - AcceptButton = _button1; - break; - default: - AcceptButton = _showHelpButton ? _button4 : _button1; - break; - } - } - private void UpdateDefault() { switch (_defaultButton) @@ -840,32 +408,6 @@ private void UpdateDefault() } } - private void UpdateHelp(bool? showHelpButton) - { - if (showHelpButton != null) - { - return; - } - - MessageButton helpButton = _buttons switch - { - KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, - _ => throw new ArgumentOutOfRangeException() - }; - if (helpButton != null) - { - helpButton.Visible = true; - helpButton.Enabled = true; - helpButton.Text = KryptonManager.Strings.GeneralStrings.Help; - - helpButton.KeyPress += (_, _) => LaunchHelp(_messageBoxData.Owner); - - helpButton.Click += (_, _) => LaunchHelp(_messageBoxData.Owner); - } - } - private void UpdateHelp() { if (!_showHelpButton) @@ -876,8 +418,12 @@ private void UpdateHelp() MessageButton helpButton = _buttons switch { KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, + KryptonMessageBoxButtons.OKCancel + or KryptonMessageBoxButtons.YesNo + or KryptonMessageBoxButtons.RetryCancel => _button3, + KryptonMessageBoxButtons.AbortRetryIgnore + or KryptonMessageBoxButtons.YesNoCancel + or KryptonMessageBoxButtons.CancelTryContinue => _button4, _ => throw new ArgumentOutOfRangeException() }; if (helpButton != null) @@ -890,47 +436,6 @@ private void UpdateHelp() } } - /// - /// When the user clicks the Help button, the Help file specified in the helpFilePath parameter - /// is opened and the Help keyword topic identified by the keyword parameter is Displayed. - /// The form that owns the message box (or the active form) also receives the HelpRequested event. - /// - private void LaunchHelp(IWin32Window? owner) - { - try - { - if (owner != null) - { - Control? control = FromHandle(owner.Handle); - - var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); - if (_helpInfo != null) - { - if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) - { - return; - } - - if (!string.IsNullOrWhiteSpace(_helpInfo.Keyword)) - { - Help.ShowHelp(control, _helpInfo.HelpFilePath, _helpInfo.Keyword); - } - else - { - Help.ShowHelp(control, _helpInfo.HelpFilePath, _helpInfo.Navigator, _helpInfo.Param); - } - } - } - } - catch - { - // Do nothing if failure to send to Parent - } - - } - /// /// When the user clicks the Help button, the Help file specified in the helpFilePath parameter /// is opened and the Help keyword topic identified by the keyword parameter is Displayed. @@ -945,8 +450,8 @@ private void LaunchHelp() Control? control = FromHandle(_showOwner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -967,9 +472,8 @@ private void LaunchHelp() } catch { - // Do nothing if failure to send to Parent + // Do nothing } - } private void UpdateSizing(IWin32Window? showOwner) @@ -993,7 +497,6 @@ private Size UpdateMessageSizing(IWin32Window? showOwner) SizeF scaledMonitorSize = screen!.Bounds.Size; scaledMonitorSize.Width *= 2 / 3.0f; scaledMonitorSize.Height *= 0.95f; - kwlblMessageText.UpdateFont(); SizeF messageSize = g.MeasureString(_text, kwlblMessageText.Font, scaledMonitorSize); // SKC: Don't forget to add the TextExtra into the calculation SizeF captionSize = g.MeasureString($@"{_caption} {TextExtra}", kwlblMessageText.Font, scaledMonitorSize); @@ -1090,122 +593,8 @@ private Size UpdateButtonsSizing() return new Size((maxButtonSize.Width * numButtons) + (GlobalStaticValues.GLOBAL_BUTTON_PADDING * (numButtons + 1)), maxButtonSize.Height + (GlobalStaticValues.GLOBAL_BUTTON_PADDING * 2)); } - private void AnyKeyDown(object sender, KeyEventArgs e) - { - // Escape key kills the dialog if we allow it to be closed - if (ControlBox - && (e.KeyCode == Keys.Escape) - ) - { - Close(); - } - else if (!e.Control - || (e.KeyCode != Keys.C) - ) - { - return; - } - - const string DIVIDER = @"---------------------------"; - const string BUTTON_TEXT_SPACER = @" "; - - // Pressing Ctrl+C should copy message text into the clipboard - var sb = new StringBuilder(); - - sb.AppendLine(DIVIDER); - sb.AppendLine(Text); - sb.AppendLine(DIVIDER); - sb.AppendLine(kwlblMessageText.Text); - sb.AppendLine(DIVIDER); - sb.Append(_button1.Text).Append(BUTTON_TEXT_SPACER); - if (_button2.Enabled) - { - sb.Append(_button2.Text).Append(BUTTON_TEXT_SPACER); - if (_button3.Enabled) - { - sb.Append(_button3.Text).Append(BUTTON_TEXT_SPACER); - } - - if (_button4.Enabled) - { - sb.Append(_button4.Text).Append(BUTTON_TEXT_SPACER); - } - } - - sb.AppendLine(string.Empty); - sb.AppendLine(DIVIDER); - - Clipboard.SetText(sb.ToString(), TextDataFormat.Text); - Clipboard.SetText(sb.ToString(), TextDataFormat.UnicodeText); - } - - private void LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - try - { - if (_linkLabelCommand != null) - { - _linkLabelCommand.PerformExecute(); - } - else if (_linkLaunchArgument != null) - { - Process.Start(_linkLaunchArgument); - } - } - catch (Exception exception) - { - ExceptionHandler.CaptureException(exception); - } - } - - /// Updates the type of the content area. - /// Type of the content area. - private void UpdateContentAreaType(MessageBoxContentAreaType? contentAreaType) - { - switch (contentAreaType) - { - case MessageBoxContentAreaType.Normal: - klwlblMessageText.Visible = false; - - kwlblMessageText.Visible = true; - break; - case MessageBoxContentAreaType.LinkLabel: - klwlblMessageText.Visible = true; - - kwlblMessageText.Visible = false; - break; - case null: - klwlblMessageText.Visible = false; - - kwlblMessageText.Visible = true; - break; - default: - throw new ArgumentOutOfRangeException(nameof(contentAreaType), contentAreaType, null); - } - } - - private void UpdateContentLinkArea(LinkArea? contentLinkArea) - { - if (contentLinkArea != null) - { - klwlblMessageText.LinkArea = (LinkArea)contentLinkArea; - } - } - private void ShowCloseButton(bool? showCloseButton) => CloseBox = showCloseButton ?? true; - #region KryptonMessageBoxResult Methods - - public KryptonMessageBoxResult ShowMessageBox() => ShowMessageBox(null); - - // ToDo: Expand this method - public KryptonMessageBoxResult ShowMessageBox(IWin32Window? owner) - { - return KryptonMessageBoxResult.Ignore; - } - - #endregion - #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareFormDep.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareFormDep.cs index 6de16cd21..a493065ad 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareFormDep.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/RTL Aware/VisualMessageBoxRtlAwareFormDep.cs @@ -21,7 +21,7 @@ internal partial class VisualMessageBoxRtlAwareFormDep : KryptonForm private readonly KryptonMessageBoxIcon _kryptonMessageBoxIcon; private readonly Image? _applicationImage; private readonly bool? _forceUseOfOperatingSystemIcons; - private readonly KryptonMessageBoxData _messageBoxData; + private readonly KryptonMessageBoxDataDep _messageBoxData; private readonly bool? _showCloseButton; private readonly KryptonMessageBoxDefaultButton _defaultButton; @@ -113,7 +113,7 @@ public VisualMessageBoxRtlAwareFormDep(IWin32Window? showOwner, string? text, st ShowCloseButton(showCloseButton); } - public VisualMessageBoxRtlAwareFormDep(KryptonMessageBoxData messageBoxData) + public VisualMessageBoxRtlAwareFormDep(KryptonMessageBoxDataDep messageBoxData) { _messageBoxData = messageBoxData; @@ -195,7 +195,7 @@ private void UpdateTextExtra(bool? showCtrlCopy) private void UpdateIcon(KryptonMessageBoxIcon icon) { - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { switch (icon) { @@ -304,7 +304,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven + _messageIcon.Image = OSUtilities.IsAtLeastWindowsEleven ? MessageBoxImageResources.Asterisk_Windows_11 : MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); @@ -330,7 +330,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; } @@ -347,7 +347,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = MessageBoxImageResources.Windows11; } @@ -393,7 +393,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) private void UpdateIcon() { - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { switch (_kryptonMessageBoxIcon) { @@ -501,7 +501,7 @@ private void UpdateIcon() SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven + _messageIcon.Image = OSUtilities.IsAtLeastWindowsEleven ? MessageBoxImageResources.Asterisk_Windows_11 : MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); @@ -527,7 +527,7 @@ private void UpdateIcon() SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; } @@ -543,7 +543,7 @@ private void UpdateIcon() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = MessageBoxImageResources.Windows11; } @@ -850,8 +850,12 @@ private void UpdateHelp(bool? showHelpButton) MessageButton helpButton = _buttons switch { KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, + KryptonMessageBoxButtons.OKCancel + or KryptonMessageBoxButtons.YesNo + or KryptonMessageBoxButtons.RetryCancel => _button3, + KryptonMessageBoxButtons.AbortRetryIgnore + or KryptonMessageBoxButtons.YesNoCancel + or KryptonMessageBoxButtons.CancelTryContinue => _button4, _ => throw new ArgumentOutOfRangeException() }; if (helpButton != null) @@ -904,8 +908,8 @@ private void LaunchHelp(IWin32Window? owner) Control? control = FromHandle(owner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -926,9 +930,8 @@ private void LaunchHelp(IWin32Window? owner) } catch { - // Do nothing if failure to send to Parent + // Do nothing } - } /// @@ -945,8 +948,8 @@ private void LaunchHelp() Control? control = FromHandle(_showOwner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -967,9 +970,8 @@ private void LaunchHelp() } catch { - // Do nothing if failure to send to Parent + // Do nothing } - } private void UpdateSizing(IWin32Window? showOwner) 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 86efe17fc..ddf292a47 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.Designer.cs @@ -52,7 +52,6 @@ private void InitializeComponent() this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.kpnlContentArea = new Krypton.Toolkit.KryptonPanel(); this.kwlblMessageText = new Krypton.Toolkit.KryptonTextBox(); - this.klwlblMessageText = new Krypton.Toolkit.KryptonLinkWrapLabel(); ((System.ComponentModel.ISupportInitialize)(this._messageIcon)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._panelButtons)).BeginInit(); this._panelButtons.SuspendLayout(); @@ -67,10 +66,10 @@ private void InitializeComponent() // this._messageIcon.BackColor = System.Drawing.Color.Transparent; this._messageIcon.Dock = System.Windows.Forms.DockStyle.Fill; - this._messageIcon.Location = new System.Drawing.Point(8, 4); - this._messageIcon.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4); + this._messageIcon.Location = new System.Drawing.Point(11, 5); + this._messageIcon.Margin = new System.Windows.Forms.Padding(11, 5, 5, 5); this._messageIcon.Name = "_messageIcon"; - this._messageIcon.Size = new System.Drawing.Size(33, 79); + this._messageIcon.Size = new System.Drawing.Size(44, 43); this._messageIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; this._messageIcon.TabIndex = 0; this._messageIcon.TabStop = false; @@ -84,11 +83,11 @@ private void InitializeComponent() this._panelButtons.Controls.Add(this._button1); this._panelButtons.Controls.Add(this._button2); this._panelButtons.Dock = System.Windows.Forms.DockStyle.Fill; - this._panelButtons.Location = new System.Drawing.Point(0, 87); + this._panelButtons.Location = new System.Drawing.Point(0, 53); this._panelButtons.Margin = new System.Windows.Forms.Padding(0); this._panelButtons.Name = "_panelButtons"; this._panelButtons.PanelBackStyle = Krypton.Toolkit.PaletteBackStyle.PanelAlternate; - this._panelButtons.Size = new System.Drawing.Size(203, 21); + this._panelButtons.Size = new System.Drawing.Size(271, 26); this._panelButtons.TabIndex = 0; // // _borderEdge @@ -96,9 +95,9 @@ private void InitializeComponent() this._borderEdge.BorderStyle = Krypton.Toolkit.PaletteBorderStyle.HeaderPrimary; this._borderEdge.Dock = System.Windows.Forms.DockStyle.Top; this._borderEdge.Location = new System.Drawing.Point(0, 0); - this._borderEdge.Margin = new System.Windows.Forms.Padding(2); + this._borderEdge.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this._borderEdge.Name = "_borderEdge"; - this._borderEdge.Size = new System.Drawing.Size(203, 1); + this._borderEdge.Size = new System.Drawing.Size(271, 1); this._borderEdge.Text = "kryptonBorderEdge1"; // // _button4 @@ -107,11 +106,11 @@ private void InitializeComponent() this._button4.AutoSize = true; this._button4.Enabled = false; this._button4.IgnoreAltF4 = false; - this._button4.Location = new System.Drawing.Point(203, 0); + this._button4.Location = new System.Drawing.Point(271, 0); this._button4.Margin = new System.Windows.Forms.Padding(0); - this._button4.MinimumSize = new System.Drawing.Size(38, 21); + this._button4.MinimumSize = new System.Drawing.Size(51, 26); this._button4.Name = "_button4"; - this._button4.Size = new System.Drawing.Size(38, 23); + this._button4.Size = new System.Drawing.Size(51, 32); this._button4.TabIndex = 2; this._button4.Values.Text = "B4"; this._button4.Visible = false; @@ -122,11 +121,11 @@ private void InitializeComponent() this._button3.AutoSize = true; this._button3.Enabled = false; this._button3.IgnoreAltF4 = false; - this._button3.Location = new System.Drawing.Point(166, 0); + this._button3.Location = new System.Drawing.Point(221, 0); this._button3.Margin = new System.Windows.Forms.Padding(0); - this._button3.MinimumSize = new System.Drawing.Size(38, 21); + this._button3.MinimumSize = new System.Drawing.Size(51, 26); this._button3.Name = "_button3"; - this._button3.Size = new System.Drawing.Size(38, 23); + this._button3.Size = new System.Drawing.Size(51, 32); this._button3.TabIndex = 2; this._button3.Values.Text = "B3"; this._button3.Visible = false; @@ -137,11 +136,11 @@ private void InitializeComponent() this._button1.AutoSize = true; this._button1.Enabled = false; this._button1.IgnoreAltF4 = false; - this._button1.Location = new System.Drawing.Point(90, 0); + this._button1.Location = new System.Drawing.Point(120, 0); this._button1.Margin = new System.Windows.Forms.Padding(0); - this._button1.MinimumSize = new System.Drawing.Size(38, 21); + this._button1.MinimumSize = new System.Drawing.Size(51, 26); this._button1.Name = "_button1"; - this._button1.Size = new System.Drawing.Size(38, 23); + this._button1.Size = new System.Drawing.Size(51, 32); this._button1.TabIndex = 0; this._button1.Values.Text = "B1"; this._button1.Visible = false; @@ -152,11 +151,11 @@ private void InitializeComponent() this._button2.AutoSize = true; this._button2.Enabled = false; this._button2.IgnoreAltF4 = false; - this._button2.Location = new System.Drawing.Point(128, 0); + this._button2.Location = new System.Drawing.Point(171, 0); this._button2.Margin = new System.Windows.Forms.Padding(0); - this._button2.MinimumSize = new System.Drawing.Size(38, 21); + this._button2.MinimumSize = new System.Drawing.Size(51, 26); this._button2.Name = "_button2"; - this._button2.Size = new System.Drawing.Size(38, 23); + this._button2.Size = new System.Drawing.Size(51, 32); this._button2.TabIndex = 1; this._button2.Values.Text = "B2"; this._button2.Visible = false; @@ -166,9 +165,9 @@ private void InitializeComponent() this.kryptonPanel1.Controls.Add(this.tableLayoutPanel1); this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonPanel1.Location = new System.Drawing.Point(0, 0); - this.kryptonPanel1.Margin = new System.Windows.Forms.Padding(2); + this.kryptonPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.kryptonPanel1.Name = "kryptonPanel1"; - this.kryptonPanel1.Size = new System.Drawing.Size(203, 108); + this.kryptonPanel1.Size = new System.Drawing.Size(271, 79); this.kryptonPanel1.TabIndex = 1; // // tableLayoutPanel1 @@ -182,22 +181,22 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.kpnlContentArea, 1, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(203, 108); + this.tableLayoutPanel1.Size = new System.Drawing.Size(271, 79); this.tableLayoutPanel1.TabIndex = 0; // // kpnlContentArea // this.kpnlContentArea.Controls.Add(this.kwlblMessageText); - this.kpnlContentArea.Controls.Add(this.klwlblMessageText); this.kpnlContentArea.Dock = System.Windows.Forms.DockStyle.Fill; - this.kpnlContentArea.Location = new System.Drawing.Point(48, 3); + this.kpnlContentArea.Location = new System.Drawing.Point(64, 4); + this.kpnlContentArea.Margin = new System.Windows.Forms.Padding(4); this.kpnlContentArea.Name = "kpnlContentArea"; - this.kpnlContentArea.Size = new System.Drawing.Size(152, 81); + this.kpnlContentArea.Size = new System.Drawing.Size(203, 45); this.kpnlContentArea.TabIndex = 1; // // kwlblMessageText @@ -205,36 +204,25 @@ private void InitializeComponent() this.kwlblMessageText.Dock = System.Windows.Forms.DockStyle.Fill; this.kwlblMessageText.InputControlStyle = Krypton.Toolkit.InputControlStyle.PanelClient; this.kwlblMessageText.Location = new System.Drawing.Point(0, 0); - this.kwlblMessageText.Margin = new System.Windows.Forms.Padding(5, 0, 0, 0); + this.kwlblMessageText.Margin = new System.Windows.Forms.Padding(7, 0, 0, 0); this.kwlblMessageText.Multiline = true; - this.kwlblMessageText.Name = "_messageText"; + this.kwlblMessageText.Name = "kwlblMessageText"; this.kwlblMessageText.ReadOnly = true; - this.kwlblMessageText.Size = new System.Drawing.Size(176, 44); + this.kwlblMessageText.Size = new System.Drawing.Size(203, 45); this.kwlblMessageText.StateCommon.Border.DrawBorders = Krypton.Toolkit.PaletteDrawBorders.None; this.kwlblMessageText.TabIndex = 0; this.kwlblMessageText.TabStop = false; this.kwlblMessageText.Text = "Message Text\r\n.\ttabbed"; // - // klwlblMessageText - // - this.klwlblMessageText.AutoSize = false; - this.klwlblMessageText.Dock = System.Windows.Forms.DockStyle.Fill; - this.klwlblMessageText.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; - this.klwlblMessageText.Location = new System.Drawing.Point(0, 0); - this.klwlblMessageText.Name = "klwlblMessageText"; - this.klwlblMessageText.Size = new System.Drawing.Size(152, 81); - this.klwlblMessageText.Text = "Message Text"; - this.klwlblMessageText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // VisualMessageBoxForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(203, 108); + this.ClientSize = new System.Drawing.Size(271, 79); this.Controls.Add(this.kryptonPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.KeyPreview = true; - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "VisualMessageBoxForm"; @@ -253,7 +241,9 @@ private void InitializeComponent() this.tableLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.kpnlContentArea)).EndInit(); this.kpnlContentArea.ResumeLayout(false); + this.kpnlContentArea.PerformLayout(); this.ResumeLayout(false); + } #endregion @@ -267,7 +257,6 @@ private void InitializeComponent() private KryptonPanel kryptonPanel1; private TableLayoutPanel tableLayoutPanel1; private KryptonPanel kpnlContentArea; - private KryptonLinkWrapLabel klwlblMessageText; private KryptonTextBox kwlblMessageText; } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs index dead1a620..9b3b6f855 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxForm.cs @@ -22,38 +22,19 @@ internal partial class VisualMessageBoxForm : KryptonForm private readonly bool _showHelpButton; private readonly string? _text; private readonly string? _caption; - private readonly string _applicationPath; private readonly KryptonMessageBoxButtons _buttons; private readonly KryptonMessageBoxIcon _kryptonMessageBoxIcon; - private readonly Image? _applicationImage; - private readonly bool? _forceUseOfOperatingSystemIcons; - private readonly KryptonMessageBoxData _messageBoxData; - private readonly bool? _showCloseButton; - private readonly KryptonMessageBoxDefaultButton _defaultButton; // If help information provided, or we are not a service/default desktop application then grab an owner for showing the message box private readonly IWin32Window? _showOwner; private readonly HelpInfo? _helpInfo; - // For the LinkLabel option - private readonly MessageBoxContentAreaType? _contentAreaType; - private readonly KryptonCommand? _linkLabelCommand; - private readonly ProcessStartInfo? _linkLaunchArgument; - private readonly LinkArea _contentLinkArea; - - private KryptonMessageBoxResult _messageBoxResult; - #endregion #region Public - public KryptonMessageBoxResult MessageBoxResult - { - get => _messageBoxResult; - - set => _messageBoxResult = value; - } + public KryptonMessageBoxResult MessageBoxResult { get; set; } #endregion @@ -64,24 +45,21 @@ public VisualMessageBoxForm() InitializeComponent(); } - internal VisualMessageBoxForm(IWin32Window? showOwner, string? text, string? caption, KryptonMessageBoxButtons buttons, KryptonMessageBoxIcon icon, KryptonMessageBoxDefaultButton defaultButton, HelpInfo? helpInfo, bool? showCtrlCopy, bool? showHelpButton, - Image? applicationImage, - string? applicationPath, - MessageBoxContentAreaType? contentAreaType, - KryptonCommand? linkLabelCommand, - ProcessStartInfo? linkLaunchArgument, - LinkArea? contentLinkArea, - bool? forceUseOfOperatingSystemIcons, bool? showCloseButton) { // Store incoming values - _text = text; + if (text != null && !text.Contains('\n')) + { + _text = "\r\n"; // \n means that the single line text should align with the icon + } + + _text += text; _caption = caption; _buttons = buttons; _kryptonMessageBoxIcon = icon; @@ -89,16 +67,6 @@ internal VisualMessageBoxForm(IWin32Window? showOwner, string? text, string? cap _helpInfo = helpInfo; _showOwner = showOwner; _showHelpButton = showHelpButton ?? (helpInfo != null); - _applicationImage = applicationImage; - _applicationPath = applicationPath ?? string.Empty; - _contentAreaType = contentAreaType ?? MessageBoxContentAreaType.Normal; - _linkLabelCommand = linkLabelCommand ?? new KryptonCommand(); - _contentLinkArea = string.IsNullOrEmpty(text) - ? new LinkArea(0, 0) - : contentLinkArea ?? new LinkArea(0, text.Length); - _linkLaunchArgument = linkLaunchArgument ?? new ProcessStartInfo(); - _forceUseOfOperatingSystemIcons = forceUseOfOperatingSystemIcons ?? false; - _showCloseButton = showCloseButton ?? true; // Create the form contents InitializeComponent(); @@ -110,91 +78,23 @@ internal VisualMessageBoxForm(IWin32Window? showOwner, string? text, string? cap UpdateDefault(); UpdateHelp(); UpdateTextExtra(showCtrlCopy); - UpdateContentAreaType(contentAreaType); - UpdateContentLinkArea(contentLinkArea); - // Finally calculate and set form sizing UpdateSizing(showOwner); ShowCloseButton(showCloseButton); } - public VisualMessageBoxForm(KryptonMessageBoxData messageBoxData) - { - // Store incoming values - _messageBoxData = messageBoxData; - - // Create the form contents - InitializeComponent(); - - RightToLeftLayout = _messageBoxData.Options.HasFlag(MessageBoxOptions.RtlReading); - - // Update contents to match requirements - UpdateText(_messageBoxData.Caption, _messageBoxData.MessageText, _messageBoxData.Options, _messageBoxData.MessageContentAreaType); - UpdateIcon(_messageBoxData.Icon); - UpdateButtons(_messageBoxData.Buttons); - UpdateDefault(_messageBoxData.DefaultButton); - UpdateHelp(_messageBoxData.ShowHelpButton); - UpdateTextExtra(_messageBoxData.ShowCtrlCopy); - UpdateContentAreaType(_messageBoxData.MessageContentAreaType); - UpdateContentLinkArea(_messageBoxData.ContentLinkArea); - - ShowCloseButton(_messageBoxData.ShowCloseButton); - - // Finally calculate and set form sizing - UpdateSizing(_messageBoxData.Owner); - } - #endregion Identity #region Implementation - private void UpdateText(string? caption, string? text, MessageBoxOptions options, MessageBoxContentAreaType? contentAreaType) - { - // Set the text of the form - Text = string.IsNullOrEmpty(caption) ? string.Empty : caption.Split(Environment.NewLine.ToCharArray())[0]; - - switch (contentAreaType) - { - case MessageBoxContentAreaType.Normal: - kwlblMessageText.Text = text; - - kwlblMessageText.RightToLeft = options.HasFlag(MessageBoxOptions.RightAlign) ? RightToLeft.Yes : - options.HasFlag(MessageBoxOptions.RtlReading) ? RightToLeft.Inherit : RightToLeft.No; - break; - case MessageBoxContentAreaType.LinkLabel: - klwlblMessageText.Text = text; - - klwlblMessageText.RightToLeft = options.HasFlag(MessageBoxOptions.RightAlign) - ? - RightToLeft.Yes - : options.HasFlag(MessageBoxOptions.RtlReading) - ? RightToLeft.Inherit - : RightToLeft.No; - break; - case null: - kwlblMessageText.Text = text; - - kwlblMessageText.RightToLeft = options.HasFlag(MessageBoxOptions.RightAlign) ? RightToLeft.Yes : - options.HasFlag(MessageBoxOptions.RtlReading) ? RightToLeft.Inherit : RightToLeft.No; - break; - default: - throw new ArgumentOutOfRangeException(nameof(contentAreaType), contentAreaType, null); - } - } - private void UpdateText() { - Text = string.IsNullOrEmpty(_caption) ? string.Empty : _caption.Split(Environment.NewLine.ToCharArray())[0]; + Text = string.IsNullOrEmpty(_caption) + ? string.Empty + : _caption!.Split(Environment.NewLine.ToCharArray())[0]; - if (_contentAreaType == MessageBoxContentAreaType.Normal) - { - kwlblMessageText.Text = _text; - } - else - { - klwlblMessageText.Text = _text; - } + kwlblMessageText.Text = _text; } private void UpdateTextExtra(bool? showCtrlCopy) @@ -216,102 +116,27 @@ private void UpdateTextExtra(bool? showCtrlCopy) } } - private void UpdateIcon(KryptonMessageBoxIcon icon) + private void UpdateIcon() { - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { - switch (icon) - { - case KryptonMessageBoxIcon.None: - // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; - case KryptonMessageBoxIcon.Hand: - _messageIcon.Image = MessageBoxImageResources.GenericHand; - SystemSounds.Hand.Play(); - break; - case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; - SystemSounds.Question.Play(); - break; - case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Stop: - _messageIcon.Image = MessageBoxImageResources.GenericStop; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Error: - _messageIcon.Image = MessageBoxImageResources.Critical_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Warning: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Information: - _messageIcon.Image = MessageBoxImageResources.Information_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Shield: - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - break; - case KryptonMessageBoxIcon.WindowsLogo: - _messageIcon.Image = MessageBoxImageResources.Windows11; - break; - case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) - { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); - Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - } - break; - case KryptonMessageBoxIcon.SystemApplication: - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - break; - } - } - else - { - switch (icon) + switch (_kryptonMessageBoxIcon) { case KryptonMessageBoxIcon.None: // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; case KryptonMessageBoxIcon.Hand: _messageIcon.Image = MessageBoxImageResources.GenericHand; SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.SystemHand: + //case KryptonMessageBoxIcon.SystemStop: + //case KryptonMessageBoxIcon.SystemError: _messageIcon.Image = SystemIcons.Hand.ToBitmap(); SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.GenericQuestion; + _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; SystemSounds.Question.Play(); break; case KryptonMessageBoxIcon.SystemQuestion: @@ -319,7 +144,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Question.Play(); break; case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.GenericWarning; + _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.SystemExclamation: @@ -327,9 +152,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven - ? MessageBoxImageResources.Asterisk_Windows_11 - : MessageBoxImageResources.GenericAsterisk; + _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.SystemAsterisk: @@ -340,113 +163,6 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) _messageIcon.Image = MessageBoxImageResources.GenericStop; SystemSounds.Asterisk.Play(); break; - case KryptonMessageBoxIcon.Error: - _messageIcon.Image = MessageBoxImageResources.GenericCritical; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Warning: - _messageIcon.Image = MessageBoxImageResources.GenericWarning; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Information: - _messageIcon.Image = MessageBoxImageResources.GenericInformation; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - } - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_10; - } - else - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_7; - } - - break; - case KryptonMessageBoxIcon.WindowsLogo: - // Because Windows 11 displays a generic application icon, - // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = MessageBoxImageResources.Windows11; - } - // Windows 10 - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = MessageBoxImageResources.Windows_8_and_10_Logo; - } - else - { - _messageIcon.Image = SystemIcons.WinLogo.ToBitmap(); - } - - break; - case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) - { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath) - ?.ToBitmap(); - Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - } - - break; - case KryptonMessageBoxIcon.SystemApplication: - _messageIcon.Image = SystemIcons.Application.ToBitmap(); - break; - } - } - - _messageIcon.Visible = (_kryptonMessageBoxIcon != KryptonMessageBoxIcon.None); - } - - private void UpdateIcon() - { - if (OSUtilities.IsWindowsEleven) - { - switch (_kryptonMessageBoxIcon) - { - case KryptonMessageBoxIcon.None: - // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } - break; - case KryptonMessageBoxIcon.Hand: - _messageIcon.Image = MessageBoxImageResources.GenericHand; - SystemSounds.Hand.Play(); - break; - case KryptonMessageBoxIcon.Question: - _messageIcon.Image = MessageBoxImageResources.Question_Windows_11; - SystemSounds.Question.Play(); - break; - case KryptonMessageBoxIcon.Exclamation: - _messageIcon.Image = MessageBoxImageResources.Warning_Windows_11; - SystemSounds.Exclamation.Play(); - break; - case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = MessageBoxImageResources.Asterisk_Windows_11; - SystemSounds.Asterisk.Play(); - break; - case KryptonMessageBoxIcon.Stop: - _messageIcon.Image = MessageBoxImageResources.GenericStop; - SystemSounds.Asterisk.Play(); - break; case KryptonMessageBoxIcon.Error: _messageIcon.Image = MessageBoxImageResources.Critical_Windows_11; SystemSounds.Asterisk.Play(); @@ -463,24 +179,18 @@ private void UpdateIcon() _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; break; case KryptonMessageBoxIcon.WindowsLogo: + // Because Windows 11 displays a generic application icon, + // we need to rely on an image instead _messageIcon.Image = MessageBoxImageResources.Windows11; break; case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); + var applicationPath = Application.ExecutablePath; + Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(applicationPath)?.ToBitmap(); Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); + _messageIcon.Image = scaledImage ?? + // Fall back to defaults + SystemIcons.Application.ToBitmap(); } break; case KryptonMessageBoxIcon.SystemApplication: @@ -494,16 +204,14 @@ private void UpdateIcon() { case KryptonMessageBoxIcon.None: // Windows XP and before will Beep, Vista and above do not! - if (GlobalStaticValues.OS_MAJOR_VERSION < 6) - { - SystemSounds.Beep.Play(); - } break; case KryptonMessageBoxIcon.Hand: _messageIcon.Image = MessageBoxImageResources.GenericHand; SystemSounds.Hand.Play(); break; case KryptonMessageBoxIcon.SystemHand: + //case KryptonMessageBoxIcon.SystemStop: + //case KryptonMessageBoxIcon.SystemError: _messageIcon.Image = SystemIcons.Hand.ToBitmap(); SystemSounds.Hand.Play(); break; @@ -524,9 +232,7 @@ private void UpdateIcon() SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven - ? MessageBoxImageResources.Asterisk_Windows_11 - : MessageBoxImageResources.GenericAsterisk; + _messageIcon.Image = MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.SystemAsterisk: @@ -550,52 +256,23 @@ private void UpdateIcon() SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; - } - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_10; - } - else - { - _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_7; - } + _messageIcon.Image = OSUtilities.IsWindowsTen + ? UACShieldIconResources.UAC_Shield_Windows_10 + : UACShieldIconResources.UAC_Shield_Windows_7; break; case KryptonMessageBoxIcon.WindowsLogo: - // Because Windows 11 displays a generic application icon, - // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) - { - _messageIcon.Image = MessageBoxImageResources.Windows11; - } - // Windows 10 - else if (OSUtilities.IsWindowsTen) - { - _messageIcon.Image = MessageBoxImageResources.Windows_8_and_10_Logo; - } - else - { - _messageIcon.Image = SystemIcons.WinLogo.ToBitmap(); - } + _messageIcon.Image = OSUtilities.IsWindowsTen + ? MessageBoxImageResources.Windows_8_and_10_Logo + : SystemIcons.WinLogo.ToBitmap(); break; case KryptonMessageBoxIcon.Application: - if (_applicationImage != null) { - _messageIcon.Image = _applicationImage; - } - else if (!string.IsNullOrEmpty(_applicationPath)) - { - Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(_applicationPath)?.ToBitmap(); + var applicationPath = Application.ExecutablePath; + Image? sourceImage = GraphicsExtensions.ExtractIconFromFilePath(applicationPath)?.ToBitmap(); Image? scaledImage = GraphicsExtensions.ScaleImage(sourceImage, new Size(32, 32)); - - _messageIcon.Image = scaledImage; - } - else - { - // Fall back to defaults - _messageIcon.Image = SystemIcons.Application.ToBitmap(); + _messageIcon.Image = scaledImage ?? + // Fall back to defaults + SystemIcons.Application.ToBitmap(); } break; case KryptonMessageBoxIcon.SystemApplication: @@ -616,107 +293,7 @@ private void UpdateButtons() _button1.Visible = true; _button1.Enabled = true; break; - case KryptonMessageBoxButtons.OKCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.OK; - _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button1.DialogResult = DialogResult.OK; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case KryptonMessageBoxButtons.YesNo: - _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; - _button2.Text = KryptonManager.Strings.GeneralStrings.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 KryptonMessageBoxButtons.YesNoCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; - _button2.Text = KryptonManager.Strings.GeneralStrings.No; - _button3.Text = KryptonManager.Strings.GeneralStrings.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 KryptonMessageBoxButtons.RetryCancel: - _button1.Text = KryptonManager.Strings.GeneralStrings.Retry; - _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button1.DialogResult = DialogResult.Retry; - _button2.DialogResult = DialogResult.Cancel; - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - break; - case KryptonMessageBoxButtons.AbortRetryIgnore: - _button1.Text = KryptonManager.Strings.GeneralStrings.Abort; - _button2.Text = KryptonManager.Strings.GeneralStrings.Retry; - _button3.Text = KryptonManager.Strings.GeneralStrings.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; - case KryptonMessageBoxButtons.CancelTryContinue: - _button1.Text = KryptonManager.Strings.GeneralStrings.Cancel; - _button2.Text = KryptonManager.Strings.GeneralStrings.TryAgain; - _button3.Text = KryptonManager.Strings.GeneralStrings.Continue; - _button1.DialogResult = DialogResult.Cancel; -#if NET6_0_OR_GREATER - _button2.DialogResult = DialogResult.TryAgain; - _button3.DialogResult = DialogResult.Continue; -#else - _button2.DialogResult = (DialogResult)10; - _button3.DialogResult = (DialogResult)11; -#endif - _button1.Visible = true; - _button1.Enabled = true; - _button2.Visible = true; - _button2.Enabled = true; - _button3.Visible = true; - _button3.Enabled = true; - break; - } - - // Do we ignore the Alt+F4 on the buttons? - if (!ControlBox) - { - _button1.IgnoreAltF4 = true; - _button2.IgnoreAltF4 = true; - _button3.IgnoreAltF4 = true; - _button4.IgnoreAltF4 = true; - } - } - private void UpdateButtons(KryptonMessageBoxButtons buttons) - { - switch (buttons) - { - case KryptonMessageBoxButtons.OK: - _button1.Text = KryptonManager.Strings.GeneralStrings.OK; - _button1.DialogResult = DialogResult.OK; - _button1.Visible = true; - _button1.Enabled = true; - break; case KryptonMessageBoxButtons.OKCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.OK; _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; @@ -727,6 +304,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Visible = true; _button2.Enabled = true; break; + case KryptonMessageBoxButtons.YesNo: _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; _button2.Text = KryptonManager.Strings.GeneralStrings.No; @@ -738,6 +316,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Enabled = true; ControlBox = false; break; + case KryptonMessageBoxButtons.YesNoCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.Yes; _button2.Text = KryptonManager.Strings.GeneralStrings.No; @@ -752,6 +331,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button3.Visible = true; _button3.Enabled = true; break; + case KryptonMessageBoxButtons.RetryCancel: _button1.Text = KryptonManager.Strings.GeneralStrings.Retry; _button2.Text = KryptonManager.Strings.GeneralStrings.Cancel; @@ -762,6 +342,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button2.Visible = true; _button2.Enabled = true; break; + case KryptonMessageBoxButtons.AbortRetryIgnore: _button1.Text = KryptonManager.Strings.GeneralStrings.Abort; _button2.Text = KryptonManager.Strings.GeneralStrings.Retry; @@ -777,6 +358,7 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) _button3.Enabled = true; ControlBox = false; break; + case KryptonMessageBoxButtons.CancelTryContinue: _button1.Text = KryptonManager.Strings.GeneralStrings.Cancel; _button2.Text = KryptonManager.Strings.GeneralStrings.TryAgain; @@ -808,34 +390,6 @@ private void UpdateButtons(KryptonMessageBoxButtons buttons) } } - private void UpdateDefault(KryptonMessageBoxDefaultButton? defaultButton) - { - switch (defaultButton) - { - case KryptonMessageBoxDefaultButton.Button1: - //_button1.Select(); - AcceptButton = _button1; - break; - case KryptonMessageBoxDefaultButton.Button2: - //_button2.Select(); - AcceptButton = _button2; - break; - case KryptonMessageBoxDefaultButton.Button3: - //_button3.Select(); - AcceptButton = _button3; - break; - case KryptonMessageBoxDefaultButton.Button4: - AcceptButton = _showHelpButton ? _button4 : _button1; - break; - case null: - AcceptButton = _button1; - break; - default: - AcceptButton = _showHelpButton ? _button4 : _button1; - break; - } - } - private void UpdateDefault() { switch (_defaultButton) @@ -861,32 +415,6 @@ private void UpdateDefault() } } - private void UpdateHelp(bool? showHelpButton) - { - if (showHelpButton != null) - { - return; - } - - MessageButton helpButton = _buttons switch - { - KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, - _ => throw new ArgumentOutOfRangeException() - }; - if (helpButton != null) - { - helpButton.Visible = true; - helpButton.Enabled = true; - helpButton.Text = KryptonManager.Strings.GeneralStrings.Help; - - helpButton.KeyPress += (_, _) => LaunchHelp(_messageBoxData.Owner); - - helpButton.Click += (_, _) => LaunchHelp(_messageBoxData.Owner); - } - } - private void UpdateHelp() { if (!_showHelpButton) @@ -897,8 +425,12 @@ private void UpdateHelp() MessageButton helpButton = _buttons switch { KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, + KryptonMessageBoxButtons.OKCancel + or KryptonMessageBoxButtons.YesNo + or KryptonMessageBoxButtons.RetryCancel => _button3, + KryptonMessageBoxButtons.AbortRetryIgnore + or KryptonMessageBoxButtons.YesNoCancel + or KryptonMessageBoxButtons.CancelTryContinue => _button4, _ => throw new ArgumentOutOfRangeException() }; if (helpButton != null) @@ -911,47 +443,6 @@ private void UpdateHelp() } } - /// - /// When the user clicks the Help button, the Help file specified in the helpFilePath parameter - /// is opened and the Help keyword topic identified by the keyword parameter is Displayed. - /// The form that owns the message box (or the active form) also receives the HelpRequested event. - /// - private void LaunchHelp(IWin32Window? owner) - { - try - { - if (owner != null) - { - Control? control = FromHandle(owner.Handle); - - var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); - if (_helpInfo != null) - { - if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) - { - return; - } - - if (!string.IsNullOrWhiteSpace(_helpInfo.Keyword)) - { - Help.ShowHelp(control, _helpInfo.HelpFilePath, _helpInfo.Keyword); - } - else - { - Help.ShowHelp(control, _helpInfo.HelpFilePath, _helpInfo.Navigator, _helpInfo.Param); - } - } - } - } - catch - { - // Do nothing if failure to send to Parent - } - - } - /// /// When the user clicks the Help button, the Help file specified in the helpFilePath parameter /// is opened and the Help keyword topic identified by the keyword parameter is Displayed. @@ -966,8 +457,8 @@ private void LaunchHelp() Control? control = FromHandle(_showOwner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -988,7 +479,7 @@ private void LaunchHelp() } catch { - // Do nothing if failure to send to Parent + // Do nothing } } @@ -1157,77 +648,15 @@ private void AnyKeyDown(object sender, KeyEventArgs e) Clipboard.SetText(sb.ToString(), TextDataFormat.UnicodeText); } - private void LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - try - { - if (_linkLabelCommand != null) - { - _linkLabelCommand.PerformExecute(); - } - else if (_linkLaunchArgument != null) - { - Process.Start(_linkLaunchArgument); - } - } - catch (Exception exception) - { - ExceptionHandler.CaptureException(exception); - } - } - - /// Updates the type of the content area. - /// Type of the content area. - private void UpdateContentAreaType(MessageBoxContentAreaType? contentAreaType) - { - switch (contentAreaType) - { - case MessageBoxContentAreaType.Normal: - klwlblMessageText.Visible = false; - - kwlblMessageText.Visible = true; - break; - case MessageBoxContentAreaType.LinkLabel: - klwlblMessageText.Visible = true; - - kwlblMessageText.Visible = false; - break; - case null: - klwlblMessageText.Visible = false; - - kwlblMessageText.Visible = true; - break; - default: - throw new ArgumentOutOfRangeException(nameof(contentAreaType), contentAreaType, null); - } - } - - private void UpdateContentLinkArea(LinkArea? contentLinkArea) - { - if (contentLinkArea != null) - { - klwlblMessageText.LinkArea = (LinkArea)contentLinkArea; - } - } - private void ShowCloseButton(bool? showCloseButton) => CloseBox = showCloseButton ?? true; - #region KryptonMessageBoxResult Methods - - public KryptonMessageBoxResult ShowMessageBox() => ShowMessageBox(null); - - // ToDo: Expand this method - public KryptonMessageBoxResult ShowMessageBox(IWin32Window? owner) - { - return KryptonMessageBoxResult.Ignore; - } - - #endregion - #endregion } #region Types + /// + /// + /// public class HelpInfo { #region Identity diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxFormDep.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxFormDep.cs index af7faf8b1..d30ee287f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxFormDep.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualMessageBoxFormDep.cs @@ -27,7 +27,7 @@ internal partial class VisualMessageBoxFormDep : KryptonForm private readonly KryptonMessageBoxIcon _kryptonMessageBoxIcon; private readonly Image? _applicationImage; private readonly bool? _forceUseOfOperatingSystemIcons; - private readonly KryptonMessageBoxData _messageBoxData; + private readonly KryptonMessageBoxDataDep _messageBoxData; private readonly bool? _showCloseButton; private readonly KryptonMessageBoxDefaultButton _defaultButton; @@ -118,7 +118,7 @@ internal VisualMessageBoxFormDep(IWin32Window? showOwner, string? text, string? ShowCloseButton(showCloseButton); } - public VisualMessageBoxFormDep(KryptonMessageBoxData messageBoxData) + public VisualMessageBoxFormDep(KryptonMessageBoxDataDep messageBoxData) { // Store incoming values _messageBoxData = messageBoxData; @@ -217,7 +217,7 @@ private void UpdateTextExtra(bool? showCtrlCopy) private void UpdateIcon(KryptonMessageBoxIcon icon) { - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { switch (icon) { @@ -326,7 +326,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven + _messageIcon.Image = OSUtilities.IsAtLeastWindowsEleven ? MessageBoxImageResources.Asterisk_Windows_11 : MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); @@ -352,7 +352,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; } @@ -369,7 +369,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = MessageBoxImageResources.Windows11; } @@ -415,7 +415,7 @@ private void UpdateIcon(KryptonMessageBoxIcon icon) private void UpdateIcon() { - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { switch (_kryptonMessageBoxIcon) { @@ -523,7 +523,7 @@ private void UpdateIcon() SystemSounds.Exclamation.Play(); break; case KryptonMessageBoxIcon.Asterisk: - _messageIcon.Image = OSUtilities.IsWindowsEleven + _messageIcon.Image = OSUtilities.IsAtLeastWindowsEleven ? MessageBoxImageResources.Asterisk_Windows_11 : MessageBoxImageResources.GenericAsterisk; SystemSounds.Asterisk.Play(); @@ -549,7 +549,7 @@ private void UpdateIcon() SystemSounds.Asterisk.Play(); break; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = UACShieldIconResources.UAC_Shield_Windows_11; } @@ -565,7 +565,7 @@ private void UpdateIcon() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on an image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = MessageBoxImageResources.Windows11; } @@ -896,8 +896,12 @@ private void UpdateHelp() MessageButton helpButton = _buttons switch { KryptonMessageBoxButtons.OK => _button2, - KryptonMessageBoxButtons.OKCancel or KryptonMessageBoxButtons.YesNo or KryptonMessageBoxButtons.RetryCancel => _button3, - KryptonMessageBoxButtons.AbortRetryIgnore or KryptonMessageBoxButtons.YesNoCancel => _button4, + KryptonMessageBoxButtons.OKCancel + or KryptonMessageBoxButtons.YesNo + or KryptonMessageBoxButtons.RetryCancel => _button3, + KryptonMessageBoxButtons.AbortRetryIgnore + or KryptonMessageBoxButtons.YesNoCancel + or KryptonMessageBoxButtons.CancelTryContinue => _button4, _ => throw new ArgumentOutOfRangeException() }; if (helpButton != null) @@ -924,8 +928,8 @@ private void LaunchHelp(IWin32Window? owner) Control? control = FromHandle(owner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -946,9 +950,8 @@ private void LaunchHelp(IWin32Window? owner) } catch { - // Do nothing if failure to send to Parent + // Do nothing } - } /// @@ -965,8 +968,8 @@ private void LaunchHelp() Control? control = FromHandle(_showOwner.Handle); var mInfoMethod = control!.GetType().GetMethod(nameof(OnHelpRequested), BindingFlags.Instance | BindingFlags.NonPublic, - Type.DefaultBinder, [typeof(HelpEventArgs)], null)!; - mInfoMethod.Invoke(control, [new HelpEventArgs(MousePosition)]); + Type.DefaultBinder, [typeof(HelpEventArgs)], null); + mInfoMethod?.Invoke(control, [new HelpEventArgs(MousePosition)]); if (_helpInfo != null) { if (string.IsNullOrWhiteSpace(_helpInfo.HelpFilePath)) @@ -987,7 +990,7 @@ private void LaunchHelp() } catch { - // Do nothing if failure to send to Parent + // Do nothing } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs index 0c1f31faa..789493b85 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs @@ -265,7 +265,7 @@ private void UpdateIcon() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on a image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = TaskDialogImageResources.TaskDialog_Windows_11_Logo; } @@ -563,7 +563,7 @@ private void UpdateFooter() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on a image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _iconFooter.Image = TaskDialogImageResources.TaskDialog_Windows_11_Logo; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialogForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialogForm.cs index 0b1540cfa..135c1038b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialogForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialogForm.cs @@ -178,7 +178,7 @@ private void UpdateIcon() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on a image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _messageIcon.Image = TaskDialogImageResources.TaskDialog_Windows_11_Logo; } @@ -476,7 +476,7 @@ private void UpdateFooter() case KryptonMessageBoxIcon.WindowsLogo: // Because Windows 11 displays a generic application icon, // we need to rely on a image instead - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { _iconFooter.Image = TaskDialogImageResources.TaskDialog_Windows_11_Logo; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonManagerActionList.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonManagerActionList.cs index b0aa6ecf1..a972cb7c2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonManagerActionList.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonManagerActionList.cs @@ -61,22 +61,18 @@ private void OnReset(object sender, EventArgs e) { if (_manager != null) { - KryptonMessageBoxData data = new KryptonMessageBoxData() - { - MessageText = + DialogResult result = KryptonMessageBox.Show( @"This will reset the current theme back to 'Microsoft 365 - Blue'. Do you want to continue?", - Caption = @"Reset Theme", - Icon = KryptonMessageBoxIcon.Question, - Buttons = KryptonMessageBoxButtons.YesNo - }; - - DialogResult result = KryptonMessageBox.Show(data); + @"Reset Theme", + KryptonMessageBoxButtons.YesNo, + KryptonMessageBoxIcon.Question + ); if (result == DialogResult.Yes) { _manager.GlobalPaletteMode = PaletteMode.Microsoft365Blue; - _service?.OnComponentChanged(_manager, null, _manager.GlobalPaletteMode, PaletteMode.Microsoft365Blue); + _service.OnComponentChanged(_manager, null, _manager.GlobalPaletteMode, PaletteMode.Microsoft365Blue); //UpdateVerbStatus(); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonManagerDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonManagerDesigner.cs index 9f8bdd0fb..69d0f8a98 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonManagerDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonManagerDesigner.cs @@ -103,16 +103,11 @@ private void OnReset(object sender, EventArgs e) { if (_manager != null) { - KryptonMessageBoxData data = new KryptonMessageBoxData() - { - MessageText = - @"This will reset the current theme back to 'Microsoft 365 - Blue'. Do you want to continue?", - Caption = @"Reset Theme", - Icon = KryptonMessageBoxIcon.Question, - Buttons = KryptonMessageBoxButtons.YesNo - }; - - DialogResult result = KryptonMessageBox.Show(data); + DialogResult result = KryptonMessageBox.Show(@"This will reset the current theme back to 'Microsoft 365 - Blue'. Do you want to continue?", + @"Reset Theme", + KryptonMessageBoxButtons.YesNo, + KryptonMessageBoxIcon.Question + ); if (result == DialogResult.Yes) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonThemeComboBoxDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonThemeComboBoxDesigner.cs index 81b9c7c1e..bc973f814 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonThemeComboBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonThemeComboBoxDesigner.cs @@ -83,16 +83,11 @@ private void OnReset(object sender, EventArgs e) { if (_themeComboBox != null) { - KryptonMessageBoxData data = new KryptonMessageBoxData() - { - MessageText = - @"This will reset the current theme back to 'Microsoft 365 - Blue'. Do you want to continue?", - Caption = @"Reset Theme", - Icon = KryptonMessageBoxIcon.Question, - Buttons = KryptonMessageBoxButtons.YesNo - }; - - DialogResult result = KryptonMessageBox.Show(data); + DialogResult result = KryptonMessageBox.Show(@"This will reset the current theme back to 'Microsoft 365 - Blue'. Do you want to continue?", + @"Reset Theme", + KryptonMessageBoxButtons.YesNo, + KryptonMessageBoxIcon.Question + ); if (result == DialogResult.Yes) { diff --git a/Source/Krypton Components/Krypton.Toolkit/General/Definitions.cs b/Source/Krypton Components/Krypton.Toolkit/General/Definitions.cs index c3af83e37..4a61a3bb7 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/Definitions.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/Definitions.cs @@ -1885,7 +1885,10 @@ public enum KryptonMessageBoxIcon /// Specify a hand icon. Hand = 1, - /// Specify the system hand icon. + /// + /// Specify the system hand icon. + /// The message box contains a symbol consisting of a white X in a circle with a red background. + /// SystemHand = MessageBoxIcon.Hand, /// Specify a question icon. @@ -1903,19 +1906,28 @@ public enum KryptonMessageBoxIcon /// Specify an asterisk icon. Asterisk = 4, - /// Specify the system asterisk icon. + /// + /// Specify the system asterisk icon. + /// The message box contains a symbol consisting of a lowercase letter i in a circle. + /// SystemAsterisk = MessageBoxIcon.Asterisk, /// Specify a stop icon. Stop = 5, - /// Specify the system stop icon. + /// + /// Specify the system hand icon. + /// The message box contains a symbol consisting of a white X in a circle with a red background. + /// SystemStop = MessageBoxIcon.Stop, /// Specify a error icon. Error = 6, - /// Specify the system error icon. + /// + /// Specify the system hand icon. + /// The message box contains a symbol consisting of a white X in a circle with a red background. + /// SystemError = MessageBoxIcon.Error, /// Specify a warning icon. diff --git a/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxController.cs b/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxController.cs index 642056552..3ddb42f70 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxController.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxController.cs @@ -60,7 +60,7 @@ public static DialogResult ShowCore(IWin32Window? owner, if (options is MessageBoxOptions.RightAlign or MessageBoxOptions.RtlReading) { - using var kmbrtl = new VisualMessageBoxRtlAwareForm(showOwner, text, caption, buttons, icon, + using var kmbrtl = new VisualMessageBoxRtlAwareFormDep(showOwner, text, caption, buttons, icon, defaultButton, helpInfo, showCtrlCopy, showHelpButton, applicationImage, applicationPath, contentAreaType, linkLabelCommand, linkLaunchArgument, contentLinkArea, @@ -72,7 +72,7 @@ public static DialogResult ShowCore(IWin32Window? owner, } else { - using var kmb = new VisualMessageBoxForm(showOwner, text, caption, buttons, icon, + using var kmb = new VisualMessageBoxFormDep(showOwner, text, caption, buttons, icon, defaultButton, helpInfo, showCtrlCopy, showHelpButton, applicationImage, applicationPath, contentAreaType, linkLabelCommand, linkLaunchArgument, contentLinkArea, @@ -84,7 +84,7 @@ public static DialogResult ShowCore(IWin32Window? owner, } } - public static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) + public static DialogResult ShowCore(KryptonMessageBoxDataDep messageBoxData) { messageBoxData.Caption = string.IsNullOrEmpty(messageBoxData.Caption) ? @" " : messageBoxData.Caption; @@ -92,7 +92,7 @@ public static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) if (messageBoxData.Options is MessageBoxOptions.RightAlign or MessageBoxOptions.RtlReading) { - using var kmbrtl = new VisualMessageBoxRtlAwareForm(messageBoxData); + using var kmbrtl = new VisualMessageBoxRtlAwareFormDep(messageBoxData); kmbrtl.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; @@ -100,7 +100,7 @@ public static DialogResult ShowCore(KryptonMessageBoxData messageBoxData) } else { - using var kmb = new VisualMessageBoxForm(messageBoxData); + using var kmb = new VisualMessageBoxFormDep(messageBoxData); kmb.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent; diff --git a/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxData.cs b/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxData.cs index afb24b4a3..7ac65c371 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxData.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/KryptonMessageBoxData.cs @@ -10,7 +10,7 @@ namespace Krypton.Toolkit { /// A structure that contains basic information for . - public struct KryptonMessageBoxData + public struct KryptonMessageBoxDataDep { #region Public @@ -60,7 +60,7 @@ public struct KryptonMessageBoxData /// Gets or sets the application path. /// The application path. - public string? ApplicationPath { get; set; } + public string? ExtractIconFromFilePath { get; set; } /// Gets or sets the type of the message content area. /// The type of the message content area. @@ -102,8 +102,8 @@ public struct KryptonMessageBoxData #region Identity - /// Initializes a new instance of the struct. - public KryptonMessageBoxData() + /// Initializes a new instance of the struct. + public KryptonMessageBoxDataDep() { ShowCloseButton = true; } diff --git a/Source/Krypton Components/Krypton.Toolkit/General/OutlookGrid/CustomColumns/KryptonDataGridViewTextAndImageColumn.cs b/Source/Krypton Components/Krypton.Toolkit/General/OutlookGrid/CustomColumns/KryptonDataGridViewTextAndImageColumn.cs index 0d9636100..aa09e9ea2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/OutlookGrid/CustomColumns/KryptonDataGridViewTextAndImageColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/OutlookGrid/CustomColumns/KryptonDataGridViewTextAndImageColumn.cs @@ -78,7 +78,9 @@ public override string ToString() cloned._imageSize = _imageSize; // Move the button specs over to the new clone foreach (ButtonSpec bs in ButtonSpecs) + { cloned.ButtonSpecs.Add(bs.Clone()); + } return cloned; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs index e83617e97..4c8378b55 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs @@ -224,7 +224,7 @@ public static Size GetScreenSize() => case KryptonMessageBoxIcon.Information: return MessageBoxImageResources.GenericInformation; case KryptonMessageBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { return UACShieldIconResources.UACShieldWindows11; } @@ -237,7 +237,7 @@ public static Size GetScreenSize() => return UACShieldIconResources.UACShieldWindows7881; } case KryptonMessageBoxIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { return MessageBoxImageResources.Windows11; } @@ -296,7 +296,7 @@ public static Size GetScreenSize() => case KryptonToastNotificationIcon.Information: return ToastNotificationImageResources.Toast_Notification_Information_128_x_128; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { return ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128; } @@ -313,7 +313,7 @@ public static Size GetScreenSize() => return ScaleImage(SystemIcons.Shield.ToBitmap(), newSize); } case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { return ToastNotificationImageResources.Toast_Notification_Windows_11_128_x_128; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs index 077b450ee..8da33c972 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs @@ -100,7 +100,7 @@ public static Icon CreateIconFromImage(Image sourceImage, Size? iconSize) case InformationBoxIcon.Information: return CreateIconFromImage(MessageBoxImageResources.GenericInformation, null); case InformationBoxIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { return CreateIconFromImage(UACShieldIconResources.UACShieldWindows11, null); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/OSUtilities.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/OSUtilities.cs index 0a45df6ac..6731d8114 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/OSUtilities.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/OSUtilities.cs @@ -15,39 +15,29 @@ namespace Krypton.Toolkit /// Gets access to specific information about the client operating system. public class OSUtilities { - #region Identity - - /// Initializes a new instance of the class. - public OSUtilities() - { - - } - - #endregion - #region Implementation // Note: Update these, once a new public upgrade becomes GA /// Gets a value indicating whether the client version is Windows 7. /// true if the client version is Windows 7; otherwise, false. - public static bool IsWindowsSeven => Environment.OSVersion.Version is { Major: >= 6, Minor: >= 1 }; + public static bool IsWindowsSeven => Environment.OSVersion.Version is { Major: 6, Minor: 1 }; /// Gets a value indicating whether the client version is Windows 8. /// true if the client version is Windows 8; otherwise, false. - public static bool IsWindowsEight => Environment.OSVersion.Version is { Major: >= 6, Minor: >= 2 }; + public static bool IsWindowsEight => Environment.OSVersion.Version is { Major: 6, Minor: 2 }; /// Gets a value indicating whether the client version is Windows 8.1. /// true if the client version is Windows 8.1; otherwise, false. - public static bool IsWindowsEightPointOne => Environment.OSVersion.Version is { Major: >= 6, Minor: >= 3 }; + public static bool IsWindowsEightPointOne => Environment.OSVersion.Version is { Major: 6, Minor: 3 }; /// Gets a value indicating whether the client version is Windows 10. /// true if the client version is Windows 10; otherwise, false. - public static bool IsWindowsTen => Environment.OSVersion.Version is { Major: >= 10, Build: <= 19045 }; + public static bool IsWindowsTen => Environment.OSVersion.Version is { Major: 10, Build: <= 19045 }; /// Gets a value indicating whether the client version is Windows 11. /// true if the client version is Windows 11; otherwise, false. - public static bool IsWindowsEleven => Environment.OSVersion.Version is { Major: >= 10, Build: <= 22621 }; + public static bool IsAtLeastWindowsEleven => Environment.OSVersion.Version is { Major: >= 10, Build: > 19045 }; /// Gets a value indicating whether the client is a 64 bit operating system. /// true if the client is a 64 bit operating system; otherwise, false. diff --git a/Source/Krypton Components/TestForm/Main.cs b/Source/Krypton Components/TestForm/Main.cs index ad1c7957b..5d524df13 100644 --- a/Source/Krypton Components/TestForm/Main.cs +++ b/Source/Krypton Components/TestForm/Main.cs @@ -78,7 +78,7 @@ private void kryptonButton2_Click(object sender, EventArgs e) private void kbtnTestMessagebox_Click(object sender, EventArgs e) { - KryptonMessageBoxData data = new KryptonMessageBoxData() + KryptonMessageBoxDataDep data = new KryptonMessageBoxDataDep { MessageText = @"This is a test!", Caption = @"Hello World", @@ -89,11 +89,11 @@ private void kbtnTestMessagebox_Click(object sender, EventArgs e) //Options = MessageBoxOptions.RtlReading }; - KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, + KryptonMessageBoxDep.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.Information, contentAreaType: MessageBoxContentAreaType.LinkLabel, linkAreaCommand: kcmdMessageboxTest, showCloseButton: kryptonCheckBox1.Checked); - KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, + KryptonMessageBoxDep.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.Information, options: MessageBoxOptions.RtlReading, contentAreaType: MessageBoxContentAreaType.LinkLabel, linkAreaCommand: kcmdMessageboxTest, showCloseButton: kryptonCheckBox1.Checked); } diff --git a/Source/Krypton Components/TestForm/MessageBoxTest.cs b/Source/Krypton Components/TestForm/MessageBoxTest.cs index 8411218be..222443351 100644 --- a/Source/Krypton Components/TestForm/MessageBoxTest.cs +++ b/Source/Krypton Components/TestForm/MessageBoxTest.cs @@ -20,7 +20,7 @@ public MessageBoxTest() private void kbtnTestMessagebox_Click(object sender, EventArgs e) { - KryptonMessageBoxData data = new KryptonMessageBoxData() + KryptonMessageBoxDataDep data = new KryptonMessageBoxDataDep { MessageText = @"This is a test!", Caption = @"Hello World", @@ -31,11 +31,11 @@ private void kbtnTestMessagebox_Click(object sender, EventArgs e) //Options = MessageBoxOptions.RtlReading }; - KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, + KryptonMessageBoxDep.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.Information, contentAreaType: MessageBoxContentAreaType.LinkLabel, linkAreaCommand: kcmdMessageboxTest, showCloseButton: kryptonCheckBox1.Checked); - KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, + KryptonMessageBoxDep.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.Information, options: MessageBoxOptions.RtlReading, contentAreaType: MessageBoxContentAreaType.LinkLabel, linkAreaCommand: kcmdMessageboxTest, showCloseButton: kryptonCheckBox1.Checked); From 2d89d7ab5802828efd0ba2ab0fc15dc9c5b58e34 Mon Sep 17 00:00:00 2001 From: Smurf-IV Date: Mon, 6 May 2024 10:55:52 +0100 Subject: [PATCH 2/2] - Update ChangeLog - Really resolve the changes (Stoopid github!) --- Documents/Help/Changelog.md | 1 + README.md | 3 ++- ...otificationComboBoxUserInputWithProgressBarRtlAwareForm.cs | 4 ++-- ...otificationDateTimeUserInputWithProgressBarRtlAwareForm.cs | 4 ++-- ...otificationDomianUpDownInputWithProgressBarRtlAwareForm.cs | 4 ++-- ...tificationMaskedTextBoxInputWithProgressBarRtlAwareForm.cs | 4 ++-- ...cationNumericUpDownUserInputWithProgressBarRtlAwareForm.cs | 4 ++-- ...NotificationTextBoxUserInputWithProgressBarRtlAwareForm.cs | 4 ++-- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md index b5f6afabd..0ac041fee 100644 --- a/Documents/Help/Changelog.md +++ b/Documents/Help/Changelog.md @@ -3,6 +3,7 @@ ======= ## 2024-11-xx - Build 2411 - November 2024 +* Implemented [#1435](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1435), **Breaking Change** Take KMB back to the Winform override (Remove Checkbox etc) * Implemented [#1432](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1432), Copy `KryptonMessageBox` to `KryptonMessageBoxDep` * Resolved [#1424](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1424), **Breaking Change** `KryptonMessageBox` does not obey tab characters like `MessageBox` * Resolved [#1381](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1381), **[Regression]** Docking Persistence broken since build ##.23.10.303 diff --git a/README.md b/README.md index 2bd9a7ea1..ff9db21ee 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,8 @@ Follow the links to see the different objects and layouts that this framework al ## V90.## (2024-11-xx - Build 2411 - November 2024) There are list of changes that have occurred during the development of the V90.## version -- [#1432](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1432), **Breaking Change placeholder** Copy `KryptonMessageBox` to `KryptonMessageBoxDep` +- [#1435](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1435), **Breaking Change** Take KMB back to the Winform override (Remove Checkbox etc) +- and [#1432](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1432), **Breaking Change placeholder** Copy `KryptonMessageBox` to `KryptonMessageBoxDep` - The introduction of new Parameters elements to the `KryptonMessageBox` is now supported in the `KryptonMessageBoxDep` class - This is so that the `KryptonMessageBox` gets back to being a drop in replacement for the winform `MessageBox` - And a start of the introduction of the `KryptonMessageDialog` implementation of the UWP `MessageDialog` diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarRtlAwareForm.cs index 9a65116df..4fa8a84b3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationComboBoxUserInputWithProgressBarRtlAwareForm.cs @@ -130,7 +130,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -144,7 +144,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarRtlAwareForm.cs index 787904d6b..613b81503 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDateTimeUserInputWithProgressBarRtlAwareForm.cs @@ -129,7 +129,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -143,7 +143,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarRtlAwareForm.cs index 6d136abc2..3b6e70f12 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationDomianUpDownInputWithProgressBarRtlAwareForm.cs @@ -129,7 +129,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -143,7 +143,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarRtlAwareForm.cs index 0f6dad225..20fc2e931 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationMaskedTextBoxInputWithProgressBarRtlAwareForm.cs @@ -121,7 +121,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -135,7 +135,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarRtlAwareForm.cs index 4eca692c3..807ae2919 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationNumericUpDownUserInputWithProgressBarRtlAwareForm.cs @@ -125,7 +125,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -139,7 +139,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarRtlAwareForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarRtlAwareForm.cs index 63fa68a02..a80c1fe00 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarRtlAwareForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/Notification Toast/User Input/Right to Left/ProgressBar/VisualToastNotificationTextBoxUserInputWithProgressBarRtlAwareForm.cs @@ -126,7 +126,7 @@ private void UpdateIcon() SetIcon(ToastNotificationImageResources.Toast_Notification_Information_128_x_128); break; case KryptonToastNotificationIcon.Shield: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(ToastNotificationImageResources.Toast_Notification_UAC_Shield_Windows_11_128_x_128); } @@ -140,7 +140,7 @@ private void UpdateIcon() } break; case KryptonToastNotificationIcon.WindowsLogo: - if (OSUtilities.IsWindowsEleven) + if (OSUtilities.IsAtLeastWindowsEleven) { SetIcon(WindowsLogoImageResources.Windows_11_128_128); }