Skip to content

Commit 345cbdd

Browse files
authored
Merge branch 'alpha' into 2446-V100-build-workflow
2 parents 19f6b04 + b0b78c3 commit 345cbdd

File tree

5 files changed

+62
-36
lines changed

5 files changed

+62
-36
lines changed

Documents/Changelog/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## 2025-11-xx - Build 2511 (V10 - alpha) - November 2025
66
* Implemented [#2446](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2446), Add `build.yml` to `.github/workflows`.
7+
* 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.
78
* Implemented [#648](https://github.com/Krypton-Suite/Standard-Toolkit/issues/648), SystemMenu to be theme related
89
* Resolved [#2128](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2128), (feat) Add `ButtonSpecs` to `KDataGridView` cells when editing.
910
* Resolved [#2463](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2463), `KryptonForm` has incorrect title-bar button behaviour.

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementBase.cs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Krypton.Toolkit;
1414

1515
/// <summary>
1616
/// Abstract base class where all KryptonTaskDialogElementData components must be derived from.
17-
/// Derived elements can be extended through the use of IKryptonTaskDialogElementData interfaces to
17+
/// Derived elements can be extended through the use of IKryptonTaskDialogElement interfaces to
1818
/// guarantee correct and consistent definitions and naming of properties and methods.
1919
///
2020
/// The IDisposable pattern has been implemented by default so derived classes can override and implement if required
@@ -62,7 +62,11 @@ public KryptonTaskDialogElementBase()
6262
public virtual Color BackColor1
6363
{
6464
get => Panel.StateCommon.Color1;
65-
set => Panel.StateCommon.Color1 = value;
65+
set
66+
{
67+
Panel.StateCommon.Color1 = value;
68+
OnBackColorsChanged();
69+
}
6670
}
6771

6872
/// <inheritdoc/>
@@ -72,19 +76,7 @@ public virtual Color BackColor2
7276
set
7377
{
7478
Panel.StateCommon.Color2 = value;
75-
76-
if (value != Color.Empty
77-
&& BackColor1 != Color.Empty)
78-
{
79-
//When both colors are assigned, the linear gradient is applied.
80-
Panel.StateCommon.ColorStyle = PaletteColorStyle.Linear25;
81-
Panel.StateCommon.ColorAngle = 1f;
82-
}
83-
else
84-
{
85-
Panel.StateCommon.ColorStyle = PaletteColorStyle.Inherit;
86-
Panel.StateCommon.ColorAngle = -1;
87-
}
79+
OnBackColorsChanged();
8880
}
8981
}
9082

@@ -123,7 +115,23 @@ public override string ToString()
123115
#endregion
124116

125117
#region Private
126-
public void OnVisibleChanged()
118+
private void OnBackColorsChanged()
119+
{
120+
if (BackColor1 != Color.Empty && BackColor2 != Color.Empty)
121+
{
122+
//When both colors are assigned, the linear gradient is applied.
123+
Panel.StateCommon.ColorStyle = PaletteColorStyle.Linear25;
124+
Panel.StateCommon.ColorAngle = 1f;
125+
}
126+
else
127+
{
128+
// in all other cases the gradient is turned off
129+
Panel.StateCommon.ColorStyle = PaletteColorStyle.Inherit;
130+
Panel.StateCommon.ColorAngle = -1;
131+
}
132+
}
133+
134+
private void OnVisibleChanged()
127135
{
128136
VisibleChanged?.Invoke();
129137
}

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementFooterBar.cs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public KryptonTaskDialogElementFooterBar(KryptonTaskDialogElementContent expande
6969
_disposed = false;
7070

7171
// default values
72-
ExpanderExpandedText = "Expanded";
73-
ExpanderCollapsedText = "Collapsed";
72+
ExpanderExpandedText = "Expand";
73+
ExpanderCollapsedText = "Collapse";
7474

7575
// Expander button images
7676
_expanderExpandedImage = ResourceFiles.TaskDialog.TaskDialogImageResources.DoubleChevronSmallUp_20x20;
@@ -97,7 +97,6 @@ public string FootNoteText
9797
_footNoteText.Text = value;
9898
_footNoteText.Invalidate();
9999
}
100-
101100
}
102101

103102
/// <inheritdoc/>
@@ -222,7 +221,6 @@ private void UpdateExpanderImage()
222221
{
223222
if (EnableExpanderControls)
224223
{
225-
_expanderButton.StateCommon.Back.Image = null;
226224
_expanderButton.StateCommon.Back.Image = _expander.Visible
227225
? _expanderExpandedImage
228226
: _expanderCollapsedImage;
@@ -254,12 +252,35 @@ private void UpdateExpanderEnabledState()
254252

255253
private void OnExpanderButtonClick(object? sender, EventArgs e)
256254
{
255+
// briefly detach from the event
256+
WireExpanderVisibleChanged(false);
257+
257258
// change mode
258259
_expander.Visible = !_expander.Visible;
259260

260-
// change the button icon
261+
// change the button icon & text
261262
UpdateExpanderImage();
262263
UpdateExpanderText();
264+
265+
// attach the event again
266+
WireExpanderVisibleChanged(true);
267+
}
268+
269+
private void OnExpanderVisibleChanged()
270+
{
271+
UpdateExpanderEnabledState();
272+
}
273+
274+
private void WireExpanderVisibleChanged(bool wireEvent)
275+
{
276+
if (wireEvent)
277+
{
278+
_expander.VisibleChanged += OnExpanderVisibleChanged;
279+
}
280+
else
281+
{
282+
_expander.VisibleChanged -= OnExpanderVisibleChanged;
283+
}
263284
}
264285

265286
private void SetupPanel()
@@ -325,6 +346,9 @@ private void SetupPanel()
325346
_footNoteText.MaximumSize = _size_0_tableLayoutPanelHeight;
326347
_footNoteText.MinimumSize = _size_0_tableLayoutPanelHeight;
327348
_footNoteText.StateCommon.ShortText.TextV = PaletteRelativeAlign.Center;
349+
350+
// If the expander element changes visibility we need to react to that.
351+
WireExpanderVisibleChanged(true);
328352
}
329353
#endregion
330354

@@ -334,6 +358,8 @@ protected override void Dispose(bool disposing)
334358
if (!_disposed && disposing)
335359
{
336360
_expanderButton.Click -= OnExpanderButtonClick;
361+
WireExpanderVisibleChanged(false);
362+
337363
_iconController.Dispose();
338364

339365
_disposed = true;

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/KryptonTaskDialog.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public KryptonTaskDialog()
143143
/// Show the dialog modeless.<br/>
144144
/// The DialogResult can be obtained from this instance after the modeless dialog has been closed.
145145
/// </summary>
146-
/// <param name="owner">The parent window Handle that launched this dialog.</param>
146+
/// <param name="owner">The parent window that launched this dialog.</param>
147147
public void Show(IWin32Window? owner = null)
148148
{
149149
UpdateFormSizing();
@@ -163,7 +163,7 @@ public void Show(IWin32Window? owner = null)
163163
/// Show as a modal dialog.<br/>
164164
/// The caller will wait until the dialog has been dismissed.
165165
/// </summary>
166-
/// <param name="owner">The parent window Handle that launched this dialog.</param>
166+
/// <param name="owner">The parent window that launched this dialog.</param>
167167
/// <returns>The DialogResult</returns>
168168
public DialogResult ShowDialog(IWin32Window? owner = null)
169169
{
@@ -260,12 +260,13 @@ private void UpdateFormPosition(IWin32Window? owner)
260260
{
261261
switch (Dialog.Form.StartPosition)
262262
{
263-
// Since owner is null we will default to center screen
263+
// Since owner is not null we will center on the parent
264264
case FormStartPosition.CenterParent:
265265
_form.StartPosition = FormStartPosition.Manual;
266266
_form.Location = GetLocationCenterParent(owner);
267267
break;
268268

269+
// Center on the display the owner form is on or most of it.
269270
case FormStartPosition.CenterScreen:
270271
_form.StartPosition = FormStartPosition.Manual;
271272
_form.Location = GetLocationCenterScreen(owner);

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/KryptonTaskDialogKryptonForm.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,8 @@ public KryptonTaskDialogKryptonForm()
4040
/// <inheritdoc/>>
4141
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
4242
{
43-
if (IgnoreAltF4)
44-
{
45-
// Intercept ALT+F4
46-
if ((keyData & KEYS_ALT_F4) == KEYS_ALT_F4)
47-
{
48-
// This will consume the keypress
49-
return true;
50-
}
51-
}
52-
53-
// Call the base class method for other keys
54-
return false;
43+
// Intercept ALT+F4
44+
return IgnoreAltF4 && keyData == KEYS_ALT_F4;
5545
}
5646
#endregion
5747
}

0 commit comments

Comments
 (0)