From 4c83984f65c16b3c797e9db2cf2daa50eeb4596c Mon Sep 17 00:00:00 2001 From: Smurf-IV Date: Sun, 14 Jul 2024 13:02:20 +0100 Subject: [PATCH 1/2] - Make all controls follow MinHeight of 30 (Apart from Min Trackbar :-) #615 --- Source/.editorconfig | 2 +- .../Controls Toolkit/KryptonCheckedListBox.cs | 6 +++++ .../Controls Toolkit/KryptonColorButton.cs | 4 +-- .../Controls Toolkit/KryptonComboBox.cs | 10 +++++--- .../Controls Toolkit/KryptonDomainUpDown.cs | 22 ++++++++++------ .../Controls Toolkit/KryptonGroup.cs | 1 - .../Controls Toolkit/KryptonListBox.cs | 4 +++ .../Controls Toolkit/KryptonListView.cs | 7 ++++++ .../Controls Toolkit/KryptonMaskedTextBox.cs | 4 +++ .../Controls Toolkit/KryptonMessageBox.cs | 2 +- .../Controls Toolkit/KryptonNumericUpDown.cs | 25 +++++++++++++------ .../KryptonProgressBarToolStripItem.cs | 2 +- .../Controls Toolkit/KryptonRichTextBox.cs | 4 +++ .../Controls Toolkit/KryptonTextBox.cs | 4 ++- .../Controls Toolkit/KryptonTrackBar.cs | 4 +++ .../Controls Toolkit/KryptonTreeView.cs | 4 +++ .../Controls Visuals/VisualControlBase.cs | 4 +++ .../General/GlobalStaticValues.cs | 2 ++ .../Palette Base/PaletteDefinitions.cs | 2 +- .../Krypton.Toolkit/Utilities/IconHelper.cs | 2 +- .../Krypton.Toolkit/View Base/ViewManager.cs | 2 +- .../View Draw/ViewDrawButton.cs | 3 ++- .../View Layout/ViewLayoutControl.cs | 7 +++--- 23 files changed, 95 insertions(+), 32 deletions(-) diff --git a/Source/.editorconfig b/Source/.editorconfig index 9707c8228..4a31f9ad1 100644 --- a/Source/.editorconfig +++ b/Source/.editorconfig @@ -49,5 +49,5 @@ dotnet_diagnostic.CS8073.severity = None dotnet_diagnostic.CS8618.severity = None #Warning CS8622 Nullability of reference types in type of parameter 'sender' of #### -dotnet_diagnostic.CS8622.severity = None +#dotnet_diagnostic.CS8622.severity = None diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs index 3b408d187..1f4bf7a89 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs @@ -161,6 +161,7 @@ private int InnerArrayIndexOfIdentifier(object? identifier, int stateMask) } #endregion + } /// @@ -525,6 +526,11 @@ public void RefreshItemSizes() #endregion #region Protected + + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + /// /// Creates a new instance of the item collection. /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs index 2f417c6d7..4d912d5e5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs @@ -123,7 +123,7 @@ public KryptonColorButton() AutoRecentColors = true; SchemeThemes = ColorScheme.OfficeThemes; SchemeStandard = ColorScheme.OfficeStandard; - _selectedRect = new Rectangle(0, 12, 16, 4); + _selectedRect = new Rectangle(0, 12, 16, 6); _selectedColor = Color.Red; _emptyBorderColor = Color.DarkGray; DialogResult = DialogResult.None; @@ -1504,7 +1504,7 @@ private void SetCustomColorPreviewShape(KryptonColorButtonCustomColorPreviewShap Values.RoundedCorners = 0; - Values.SelectedRect = new Rectangle(0, 12, 16, 4); + Values.SelectedRect = new Rectangle(0, 12, 16, 6); break; case KryptonColorButtonCustomColorPreviewShape.Circle: Values.Image = GenericImageResources.Transparent_16_x_16; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs index fb7c56c92..91e0d39cb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs @@ -135,7 +135,6 @@ public InternalComboBox(KryptonComboBox kryptonComboBox) { // Remember incoming reference _kryptonComboBox = kryptonComboBox; - // Remove from view until size for the first time by the Krypton control ItemHeight = 15; DropDownHeight = 200; @@ -212,6 +211,10 @@ public bool MouseOver #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + protected override void OnEnabledChanged(EventArgs e) { // Do not forward, to allow the correct Background for disabled state @@ -1143,11 +1146,10 @@ public KryptonComboBox() // Create the element that fills the remainder space and remembers fill rectangle _layoutFill = new ViewLayoutFill(_comboHolder); - // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker { - { _layoutFill, ViewDockStyle.Fill } + { _layoutFill, ViewDockStyle.Bottom } // Make it better when drawing smaller font than MinHeight }; // Create view for the control border and background @@ -2161,7 +2163,7 @@ public void DesignerMouseLeave() => OnMouseLeave(EventArgs.Empty); /// Gets or sets the height and width of the control. - [DefaultValue(typeof(Size), "121, 21")] + [DefaultValue(typeof(Size), "121, 30")] public new Size Size { get => base.Size; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs index 5e3727ab1..7808ce054 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs @@ -57,9 +57,9 @@ public InternalDomainUpDown(KryptonDomainUpDown kryptonDomainUpDown) // Remove from view until size for the first time by the Krypton control Size = Size.Empty; - // We provide the border manually BorderStyle = BorderStyle.None; + Padding = Padding.Empty; } #endregion @@ -93,6 +93,16 @@ public bool MouseOver #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.ResetDefaultMinimumSize; + + /// An that contains the event data. + protected override void OnSystemColorsChanged(EventArgs e) + { + // DO nothing, It's Krypton Colours that are in use ! + } + /// /// Process Windows-based messages. /// @@ -313,7 +323,6 @@ protected override void WndProc(ref Message m) { var tme = new PI.TRACKMOUSEEVENTS { - // This structure needs to know its own size in bytes cbSize = (uint)Marshal.SizeOf(typeof(PI.TRACKMOUSEEVENTS)), dwHoverTime = 100, @@ -567,8 +576,7 @@ protected override void WndProc(ref Message m) } // Draw the actual up and down buttons split inside the client rectangle - DrawUpDownButtons(g, - clientRect with { Height = clientRect.Height - 1 }); + DrawUpDownButtons(g, clientRect); // Now blit from the bitmap from the screen to the real dc PI.BitBlt(hdc, clientRect.X, clientRect.Y, clientRect.Width, clientRect.Height, @@ -942,7 +950,7 @@ public override Color BackColor public override Font Font { get => base.Font; - set => base.Font = value; + set => base.Font = value!; } /// @@ -1367,7 +1375,7 @@ public override Rectangle DisplayRectangle ForceViewLayout(); // The inside text box is the client rectangle size - return new Rectangle(DomainUpDown.Location, DomainUpDown.Size); + return new Rectangle(_domainUpDown.Location, _domainUpDown.Size); } } @@ -1714,7 +1722,7 @@ protected override void OnNeedPaint(object? sender, NeedLayoutEventArgs e) Font? font = triple.PaletteContent.GetContentShortTextFont(state); if ((_domainUpDown.Handle != IntPtr.Zero) && !_domainUpDown.Font.Equals(font)) { - _domainUpDown.Font = font; + _domainUpDown.Font = font!; } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroup.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroup.cs index 023274db9..85bc0e9e3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroup.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroup.cs @@ -50,7 +50,6 @@ public KryptonGroup() // Create the internal panel used for containing content Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint) { - // Make sure the panel back style always mimics our back style PanelBackStyle = PaletteBackStyle.ControlClient }; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs index 0d6a2382d..7d6531adf 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs @@ -157,6 +157,10 @@ public void RefreshItemSizes() #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + /// /// Raises the Layout event. /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs index 2b7f043db..d18b3a79f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs @@ -132,6 +132,9 @@ public bool MouseOver #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; /// Raises the event. /// An that contains the event data. @@ -146,6 +149,10 @@ protected override void OnSystemColorsChanged(EventArgs e) /// A LayoutEventArgs containing the event data. protected override void OnLayout(LayoutEventArgs levent) { + if (!IsHandleCreated || !Visible) + { + return; + } base.OnLayout(levent); // Ask the panel to layout given our available size diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs index ab0abe601..9c0b2516c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs @@ -80,6 +80,7 @@ public InternalMaskedTextBox(KryptonMaskedTextBox kryptonMaskedTextBox) // We provide the border manually BorderStyle = BorderStyle.None; + Padding = Padding.Empty; } #endregion @@ -113,6 +114,9 @@ public bool MouseOver #endregion #region Protected + //If this is here, then it will make the control have a minHeight of 37 ?!?!?! + //protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + /// /// Process Windows-based messages. /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs index 6a599380d..4a0bdb450 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMessageBox.cs @@ -52,7 +52,7 @@ public static DialogResult Show(string text, /// 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, string caption, bool? showCtrlCopy = null, + public static DialogResult Show(string? text, string caption, bool? showCtrlCopy = null, bool? showCloseButton = null) => ShowCore(null, text, caption, showCtrlCopy: showCtrlCopy, diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs index 3e5f53cca..252fb232e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs @@ -61,9 +61,9 @@ public InternalNumericUpDown(KryptonNumericUpDown kryptonNumericUpDown) // Remove from view until size for the first time by the Krypton control Size = Size.Empty; - // We provide the border manually BorderStyle = BorderStyle.None; + Padding = Padding.Empty; } public void SetChangingText(bool value) => ChangingText = value; @@ -100,6 +100,16 @@ public bool MouseOver #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + + /// An that contains the event data. + protected override void OnSystemColorsChanged(EventArgs e) + { + // DO nothing, It's Krypton Colours that are in use ! + } + /// /// Process Windows-based messages. /// @@ -590,8 +600,7 @@ protected override void WndProc(ref Message m) } // Draw the actual up and down buttons split inside the client rectangle - DrawUpDownButtons(g, - clientRect with { Height = clientRect.Height - 1 }); + DrawUpDownButtons(g, clientRect); // Now blit from the bitmap from the screen to the real dc PI.BitBlt(hdc, clientRect.X, clientRect.Y, clientRect.Width, clientRect.Height, @@ -853,11 +862,13 @@ public KryptonNumericUpDown() { DisplayPadding = new Padding(1, 1, 1, 0) }; + // When font is smaller than the Min size, then attempt to Vertical centralise the control + var layoutCentre = new ViewLayoutCenter(_layoutFill); // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker { - { _layoutFill, ViewDockStyle.Fill } + { layoutCentre, ViewDockStyle.Fill } }; // Create view for the control border and background @@ -1383,7 +1394,7 @@ public ButtonStyle UpDownButtonStyle /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) => _numericUpDown?.Select(start, length); + public void Select(int start, int length) => _numericUpDown.Select(start, length); /// /// Sets the fixed state of the control. @@ -1733,7 +1744,7 @@ protected override void OnLayout(LayoutEventArgs levent) if (IsHandleCreated || _forcedLayout || (DesignMode && (_numericUpDown != null))) { Rectangle fillRect = _layoutFill.FillRect; - _numericUpDown?.SetBounds(fillRect.X, fillRect.Y, fillRect.Width, fillRect.Height); + _numericUpDown.SetBounds(fillRect.X, fillRect.Y, fillRect.Width, fillRect.Height); } } } @@ -1769,7 +1780,7 @@ protected override void OnMouseLeave(EventArgs e) protected override void OnGotFocus(EventArgs e) { base.OnGotFocus(e); - _numericUpDown?.Focus(); + _numericUpDown.Focus(); } /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonProgressBarToolStripItem.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonProgressBarToolStripItem.cs index 606ff89b1..53fddba41 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonProgressBarToolStripItem.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonProgressBarToolStripItem.cs @@ -180,7 +180,7 @@ public bool UseValueAsText } /// - [DefaultValue(typeof(Size), @"100, 22")] + [DefaultValue(typeof(Size), @"100, 30")] public override Size Size { get => base.Size; set => base.Size = value; } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs index e1ff4f0b2..1f92d87a3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs @@ -152,6 +152,10 @@ public int Print(int charFrom, int charTo, Graphics gr, Rectangle bounds) #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + protected override void OnEnabledChanged(EventArgs e) { // Do not forward, to allow the correct Background for disabled state diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs index 6eb10a43a..b6cbaf2ef 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs @@ -60,6 +60,7 @@ public InternalTextBox(KryptonTextBox kryptonTextBox) // We provide the border manually BorderStyle = BorderStyle.None; + Padding = Padding.Empty; } #endregion @@ -93,6 +94,8 @@ public bool MouseOver #endregion #region Protected + //If this is here, then the Min Height Become 37 ?!?!?!?! + //protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; /// /// Process Windows-based messages. @@ -143,7 +146,6 @@ protected override void WndProc(ref Message m) // Grab the client area of the control PI.GetClientRect(Handle, out PI.RECT rect); - // Create rect for the text area Size borderSize = SystemInformation.BorderSize; rect.left -= borderSize.Width + 1; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs index 23197cd85..3e7193bb8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs @@ -502,6 +502,10 @@ public bool DrawBackground #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.ResetDefaultMinimumSize; // MinSize is controlled by the enum + /// /// Gets the default size of the control. /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs index 7bb34e3db..b833ba64f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs @@ -146,6 +146,10 @@ public void ResetIndent() #endregion #region Protected + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + /// /// Raises the Layout event. /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs index c2c1b6c8b..f32ea7e6a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs @@ -168,6 +168,10 @@ protected override void Dispose(bool disposing) #endregion #region Public + /// Gets the length and height, in pixels, that is specified as the default minimum size of a control. + /// A representing the size of the control. + protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize; + /// Gets or sets the associated with this control. /// The for this control, or if there is no . The default is . [Category(@"Behavior")] diff --git a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStaticValues.cs b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStaticValues.cs index 61ce045e2..b643a2c61 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/GlobalStaticValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/GlobalStaticValues.cs @@ -16,6 +16,8 @@ namespace Krypton.Toolkit /// Provides a collection of static values, used within the toolkit. public class GlobalStaticValues { + public static Size DefaultMinimumSize = new Size(0, 30); + public static Size ResetDefaultMinimumSize = new Size(0, 0); /// The default date and time value public static DateTime DEFAULT_DATE_TIME_VALUE = DateTime.Now; diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDefinitions.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDefinitions.cs index 14146cdf0..5cab5cf0e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDefinitions.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDefinitions.cs @@ -1381,7 +1381,7 @@ public enum PaletteMetricPadding HeaderButtonPaddingCalendar, /// - /// Specifies the padding for buttons on a input control. + /// Specifies the padding for buttons on an input control. /// HeaderButtonPaddingInputControl, diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs index 8da33c972..d1d114189 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/IconHelper.cs @@ -47,7 +47,7 @@ public static Icon CreateIconFromImage(Image sourceImage, Size? iconSize) { if (newSize.Height > 256 && newSize.Height > 256) { - newSize = new Size(0, 0); + newSize = GlobalStaticValues.ResetDefaultMinimumSize; } _pngIconHeader[6] = (byte)newSize.Width; diff --git a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewManager.cs b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewManager.cs index 0222e3bc0..23319e3d5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewManager.cs @@ -162,7 +162,7 @@ public bool OutputDebug /// /// Renderer provider. /// The custom-sized area for a control. - public virtual Size GetPreferredSize(IRenderer renderer, + public virtual Size GetPreferredSize(IRenderer? renderer, Size proposedSize) { if (renderer == null || Root == null) diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs index bf87ee60b..6289a5633 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs @@ -481,7 +481,8 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) CheckPaletteState(context!); // Delegate work to the child canvas - return _drawCanvas!.GetPreferredSize(context!); + var preferredSize = _drawCanvas!.GetPreferredSize(context!); + return preferredSize; } /// diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutControl.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutControl.cs index 4f260cadc..c12b28f3e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutControl.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutControl.cs @@ -217,7 +217,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) throw new ArgumentNullException(nameof(context)); } - // During disposal the view control will not longer exist + // During disposal the view control will no longer exist if (ChildControl != null) { // Ensure the control has the correct parent @@ -228,7 +228,8 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) // Ask the view for its preferred size if (ChildView != null) { - return ChildView.GetPreferredSize(context); + var preferredSize = ChildView.GetPreferredSize(context); + return preferredSize; } } @@ -249,7 +250,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) throw new ArgumentNullException(nameof(context)); } - // During disposal the view control will not longer exist + // During disposal the view control will no longer exist if (ChildControl != null) { // Ensure context has the correct control From 8c5aa59bb245210c30ae6a23d3b49c7c3d9161f8 Mon Sep 17 00:00:00 2001 From: Smurf-IV Date: Sun, 14 Jul 2024 13:06:09 +0100 Subject: [PATCH 2/2] - And the Changelog --- Documents/Changelog/Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Documents/Changelog/Changelog.md b/Documents/Changelog/Changelog.md index 91a38cbce..6dc3ade8c 100644 --- a/Documents/Changelog/Changelog.md +++ b/Documents/Changelog/Changelog.md @@ -3,6 +3,7 @@ ======= ## 2024-11-xx - Build 2411 - November 2024 +* Resolved [#615](https://github.com/Krypton-Suite/Standard-Toolkit/issues/615), Controls should have "min design heights" be the same. * Resolved [#1628](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1628), Some themes do not render the "ToolStrip" Correctly * Implemented [#632](https://github.com/Krypton-Suite/Standard-Toolkit/issues/632), **[Breaking Change]** `KryptonPropertyGrid` should have a customisable back colour. * Resolved [#1564](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1564), Disabled Button Text in Ribbons is not visible in some themes