Skip to content

Commit

Permalink
Merge branch 'alpha' into 1373-Getting-an-application-crash-when-pres…
Browse files Browse the repository at this point in the history
…sing-the-Delete-key
  • Loading branch information
giduac committed Jul 17, 2024
2 parents c59990e + d8843a2 commit 3dc9fb9
Show file tree
Hide file tree
Showing 24 changed files with 96 additions and 32 deletions.
1 change: 1 addition & 0 deletions Documents/Changelog/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [#1633](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1633), `KryptonRibbon` - Clicking the Mini QAT Menu Button causes an exception.
* Resolved [#1624](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1624), Theme Selector controls default to Professional System theme when set to `PaletteMode.Global`. Instead those shoud default to `ThemeManager.DefaultGlobalPalette`.
* Resolved [#1628](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1628), Some themes do not render the "ToolStrip" Correctly
Expand Down
2 changes: 1 addition & 1 deletion Source/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ private int InnerArrayIndexOfIdentifier(object? identifier, int stateMask)
}

#endregion

}

/// <summary>
Expand Down Expand Up @@ -525,6 +526,11 @@ public void RefreshItemSizes()
#endregion

#region Protected

/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <summary>
/// Creates a new instance of the item collection.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -212,6 +211,10 @@ public bool MouseOver
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

protected override void OnEnabledChanged(EventArgs e)
{
// Do not forward, to allow the correct Background for disabled state
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2161,7 +2163,7 @@ public void DesignerMouseLeave() =>
OnMouseLeave(EventArgs.Empty);

/// <summary>Gets or sets the height and width of the control.</summary>
[DefaultValue(typeof(Size), "121, 21")]
[DefaultValue(typeof(Size), "121, 30")]
public new Size Size
{
get => base.Size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -93,6 +93,16 @@ public bool MouseOver
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.ResetDefaultMinimumSize;

/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
protected override void OnSystemColorsChanged(EventArgs e)
{
// DO nothing, It's Krypton Colours that are in use !
}

/// <summary>
/// Process Windows-based messages.
/// </summary>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -942,7 +950,7 @@ public override Color BackColor
public override Font Font
{
get => base.Font;
set => base.Font = value;
set => base.Font = value!;
}

/// <summary>
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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!;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ public void RefreshItemSizes()
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <summary>
/// Raises the Layout event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ public bool MouseOver
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <summary>Raises the <see cref="E:System.Windows.Forms.Control.SystemColorsChanged" /> event.</summary>
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
Expand All @@ -146,6 +149,10 @@ protected override void OnSystemColorsChanged(EventArgs e)
/// <param name="levent">A LayoutEventArgs containing the event data.</param>
protected override void OnLayout(LayoutEventArgs levent)
{
if (!IsHandleCreated || !Visible)
{
return;
}
base.OnLayout(levent);

// Ask the panel to layout given our available size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public InternalMaskedTextBox(KryptonMaskedTextBox kryptonMaskedTextBox)

// We provide the border manually
BorderStyle = BorderStyle.None;
Padding = Padding.Empty;
}
#endregion

Expand Down Expand Up @@ -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;

/// <summary>
/// Process Windows-based messages.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static DialogResult Show(string text,
/// <param name="showCtrlCopy">Show extraText in title. If null (default) then only when Warning or Error icon is used.</param>
/// <param name="showCloseButton">Displays the close button. If null (default), then the close button will be displayed.</param>
/// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,6 +100,16 @@ public bool MouseOver
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
protected override void OnSystemColorsChanged(EventArgs e)
{
// DO nothing, It's Krypton Colours that are in use !
}

/// <summary>
/// Process Windows-based messages.
/// </summary>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1383,7 +1394,7 @@ public ButtonStyle UpDownButtonStyle
/// </summary>
/// <param name="start">The position of the first character in the current text selection within the text box.</param>
/// <param name="length">The number of characters to select.</param>
public void Select(int start, int length) => _numericUpDown?.Select(start, length);
public void Select(int start, int length) => _numericUpDown.Select(start, length);

/// <summary>
/// Sets the fixed state of the control.
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -1769,7 +1780,7 @@ protected override void OnMouseLeave(EventArgs e)
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
_numericUpDown?.Focus();
_numericUpDown.Focus();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public bool UseValueAsText
}

/// <inheritdoc />
[DefaultValue(typeof(Size), @"100, 22")]
[DefaultValue(typeof(Size), @"100, 30")]
public override Size Size { get => base.Size; set => base.Size = value; }

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public int Print(int charFrom, int charTo, Graphics gr, Rectangle bounds)
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

protected override void OnEnabledChanged(EventArgs e)
{
// Do not forward, to allow the correct Background for disabled state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public InternalTextBox(KryptonTextBox kryptonTextBox)

// We provide the border manually
BorderStyle = BorderStyle.None;
Padding = Padding.Empty;
}
#endregion

Expand Down Expand Up @@ -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;

/// <summary>
/// Process Windows-based messages.
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ public bool DrawBackground
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.ResetDefaultMinimumSize; // MinSize is controlled by the enum

/// <summary>
/// Gets the default size of the control.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ public void ResetIndent()
#endregion

#region Protected
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <summary>
/// Raises the Layout event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ protected override void Dispose(bool disposing)
#endregion

#region Public
/// <summary>Gets the length and height, in pixels, that is specified as the default minimum size of a control.</summary>
/// <returns>A <see cref="T:System.Drawing.Size" /> representing the size of the control.</returns>
protected override Size DefaultMinimumSize => GlobalStaticValues.DefaultMinimumSize;

/// <summary>Gets or sets the <see cref="T:System.Windows.Forms.ContextMenuStrip" /> associated with this control.</summary>
/// <returns>The <see cref="T:System.Windows.Forms.ContextMenuStrip" /> for this control, or <see langword="null" /> if there is no <see cref="T:System.Windows.Forms.ContextMenuStrip" />. The default is <see langword="null" />.</returns>
[Category(@"Behavior")]
Expand Down
Loading

0 comments on commit 3dc9fb9

Please sign in to comment.