Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
====

## 2025-11-xx - Build 2511 (V10 - alpha) - November 2025
* Implemented [#1376](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1376), **[Breaking Change]** `KryptonTaskDialog` has had a full overhaul. Please refer to the ticket for full details, status and code sample to get started.
* Implemented [#648](https://github.com/Krypton-Suite/Standard-Toolkit/issues/648), SystemMenu to be theme related
* Resolved [#2128](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2128), (feat) Add `ButtonSpecs` to `KDataGridView` cells when editing.
* Resolved [#2463](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2463), `KryptonForm` has incorrect title-bar button behaviour.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Krypton.Toolkit;

/// <summary>
/// Abstract base class where all KryptonTaskDialogElementData components must be derived from.
/// Derived elements can be extended through the use of IKryptonTaskDialogElementData interfaces to
/// Derived elements can be extended through the use of IKryptonTaskDialogElement interfaces to
/// guarantee correct and consistent definitions and naming of properties and methods.
///
/// The IDisposable pattern has been implemented by default so derived classes can override and implement if required
Expand Down Expand Up @@ -62,7 +62,11 @@ public KryptonTaskDialogElementBase()
public virtual Color BackColor1
{
get => Panel.StateCommon.Color1;
set => Panel.StateCommon.Color1 = value;
set
{
Panel.StateCommon.Color1 = value;
OnBackColorsChanged();
}
}

/// <inheritdoc/>
Expand All @@ -72,19 +76,7 @@ public virtual Color BackColor2
set
{
Panel.StateCommon.Color2 = value;

if (value != Color.Empty
&& BackColor1 != Color.Empty)
{
//When both colors are assigned, the linear gradient is applied.
Panel.StateCommon.ColorStyle = PaletteColorStyle.Linear25;
Panel.StateCommon.ColorAngle = 1f;
}
else
{
Panel.StateCommon.ColorStyle = PaletteColorStyle.Inherit;
Panel.StateCommon.ColorAngle = -1;
}
OnBackColorsChanged();
}
}

Expand Down Expand Up @@ -123,7 +115,23 @@ public override string ToString()
#endregion

#region Private
public void OnVisibleChanged()
private void OnBackColorsChanged()
{
if (BackColor1 != Color.Empty && BackColor2 != Color.Empty)
{
//When both colors are assigned, the linear gradient is applied.
Panel.StateCommon.ColorStyle = PaletteColorStyle.Linear25;
Panel.StateCommon.ColorAngle = 1f;
}
else
{
// in all other cases the gradient is turned off
Panel.StateCommon.ColorStyle = PaletteColorStyle.Inherit;
Panel.StateCommon.ColorAngle = -1;
}
}

private void OnVisibleChanged()
{
VisibleChanged?.Invoke();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public KryptonTaskDialogElementFooterBar(KryptonTaskDialogElementContent expande
_disposed = false;

// default values
ExpanderExpandedText = "Expanded";
ExpanderCollapsedText = "Collapsed";
ExpanderExpandedText = "Expand";
ExpanderCollapsedText = "Collapse";

// Expander button images
_expanderExpandedImage = ResourceFiles.TaskDialog.TaskDialogImageResources.DoubleChevronSmallUp_20x20;
Expand All @@ -97,7 +97,6 @@ public string FootNoteText
_footNoteText.Text = value;
_footNoteText.Invalidate();
}

}

/// <inheritdoc/>
Expand Down Expand Up @@ -222,7 +221,6 @@ private void UpdateExpanderImage()
{
if (EnableExpanderControls)
{
_expanderButton.StateCommon.Back.Image = null;
_expanderButton.StateCommon.Back.Image = _expander.Visible
? _expanderExpandedImage
: _expanderCollapsedImage;
Expand Down Expand Up @@ -254,12 +252,35 @@ private void UpdateExpanderEnabledState()

private void OnExpanderButtonClick(object? sender, EventArgs e)
{
// briefly detach from the event
WireExpanderVisibleChanged(false);

// change mode
_expander.Visible = !_expander.Visible;

// change the button icon
// change the button icon & text
UpdateExpanderImage();
UpdateExpanderText();

// attach the event again
WireExpanderVisibleChanged(true);
}

private void OnExpanderVisibleChanged()
{
UpdateExpanderEnabledState();
}

private void WireExpanderVisibleChanged(bool wireEvent)
{
if (wireEvent)
{
_expander.VisibleChanged += OnExpanderVisibleChanged;
}
else
{
_expander.VisibleChanged -= OnExpanderVisibleChanged;
}
}

private void SetupPanel()
Expand Down Expand Up @@ -325,6 +346,9 @@ private void SetupPanel()
_footNoteText.MaximumSize = _size_0_tableLayoutPanelHeight;
_footNoteText.MinimumSize = _size_0_tableLayoutPanelHeight;
_footNoteText.StateCommon.ShortText.TextV = PaletteRelativeAlign.Center;

// If the expander element changes visibility we need to react to that.
WireExpanderVisibleChanged(true);
}
#endregion

Expand All @@ -334,6 +358,8 @@ protected override void Dispose(bool disposing)
if (!_disposed && disposing)
{
_expanderButton.Click -= OnExpanderButtonClick;
WireExpanderVisibleChanged(false);

_iconController.Dispose();

_disposed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public KryptonTaskDialog()
/// Show the dialog modeless.<br/>
/// The DialogResult can be obtained from this instance after the modeless dialog has been closed.
/// </summary>
/// <param name="owner">The parent window Handle that launched this dialog.</param>
/// <param name="owner">The parent window that launched this dialog.</param>
public void Show(IWin32Window? owner = null)
{
UpdateFormSizing();
Expand All @@ -163,7 +163,7 @@ public void Show(IWin32Window? owner = null)
/// Show as a modal dialog.<br/>
/// The caller will wait until the dialog has been dismissed.
/// </summary>
/// <param name="owner">The parent window Handle that launched this dialog.</param>
/// <param name="owner">The parent window that launched this dialog.</param>
/// <returns>The DialogResult</returns>
public DialogResult ShowDialog(IWin32Window? owner = null)
{
Expand Down Expand Up @@ -260,12 +260,13 @@ private void UpdateFormPosition(IWin32Window? owner)
{
switch (Dialog.Form.StartPosition)
{
// Since owner is null we will default to center screen
// Since owner is not null we will center on the parent
case FormStartPosition.CenterParent:
_form.StartPosition = FormStartPosition.Manual;
_form.Location = GetLocationCenterParent(owner);
break;

// Center on the display the owner form is on or most of it.
case FormStartPosition.CenterScreen:
_form.StartPosition = FormStartPosition.Manual;
_form.Location = GetLocationCenterScreen(owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,8 @@ public KryptonTaskDialogKryptonForm()
/// <inheritdoc/>>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (IgnoreAltF4)
{
// Intercept ALT+F4
if ((keyData & KEYS_ALT_F4) == KEYS_ALT_F4)
{
// This will consume the keypress
return true;
}
}

// Call the base class method for other keys
return false;
// Intercept ALT+F4
return IgnoreAltF4 && keyData == KEYS_ALT_F4;
}
#endregion
}