Skip to content

Commit c24e413

Browse files
authored
2502-V100-CommandLinkButton-needs-some-work (#2505)
* 2502-V100-CommandLinkButton-needs-some-work - See issue for full details - And the changelog * 2502-V100-CommandLinkButton-needs-some-work - See issue for full details - And the changelog * 2502-V100-CommandLinkButton-needs-some-work - See issue for full details - And the changelog
1 parent 2aa4993 commit c24e413

File tree

6 files changed

+138
-246
lines changed

6 files changed

+138
-246
lines changed

Documents/Changelog/Changelog.md

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

55
## 2025-11-xx - Build 2511 (V10 - alpha) - November 2025
6+
* Resolved [#2502](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2502), **[Breaking Change]** `KryptonCommandLinkButton` updates several properties and their behaviour. See issue for full details.
67
* Resolved [#2495](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2495), `KryptonProgressBar` private field `_mementoContent` can be null.
78
* Resolved [#2490](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2490), `KryptonComboBox` uses an incorrect Items editor string.
89
* Resolved [#2487](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2487), `PaletteBase.PalettePaint` event is not synchronized toward the user.

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

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public KryptonCommandLinkButton()
9292
_useMnemonic = true;
9393

9494
// Create content storage
95-
CommandLinkImageValues = new CommandLinkImageValues(NeedPaintDelegate);
96-
CommandLinkImageValues.Image = CommandLinkImageResources.Windows_11_CommandLink_Arrow;
95+
UACShieldIcon = new CommandLinkImageValues(NeedPaintDelegate);
9796
CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate, GetDpiFactor);
9897

9998
// Create the palette storage
@@ -129,7 +128,7 @@ public KryptonCommandLinkButton()
129128
_overrideTracking,
130129
_overridePressed,
131130
new PaletteMetricRedirect(Redirector),
132-
CommandLinkImageValues, CommandLinkTextValues,
131+
UACShieldIcon, CommandLinkTextValues,
133132
Orientation,
134133
UseMnemonic)
135134
{
@@ -162,16 +161,20 @@ public KryptonCommandLinkButton()
162161
/// <summary>
163162
/// Gets and sets the automatic resize of the control to fit contents.
164163
/// </summary>
165-
[Browsable(false)]
164+
[Browsable(true)]
166165
[Localizable(false)]
167-
[EditorBrowsable(EditorBrowsableState.Never)]
168-
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
166+
[EditorBrowsable(EditorBrowsableState.Always)]
167+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
169168
public override bool AutoSize
170169
{
171170
get => base.AutoSize;
171+
172172
set
173173
{
174-
// Do nothing }
174+
if (base.AutoSize != value)
175+
{
176+
base.AutoSize = value;
177+
}
175178
}
176179
}
177180

@@ -229,7 +232,6 @@ public virtual VisualOrientation Orientation
229232

230233
// Update the associated visual elements that are effected
231234
_drawCommandLinkButton.Orientation = value;
232-
233235
PerformNeedPaint(true);
234236
}
235237
}
@@ -273,7 +275,7 @@ public ButtonStyle ButtonStyle
273275
[Category("CommandLink")]
274276
[Description("CommandLink Button Image")]
275277
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
276-
public CommandLinkImageValues CommandLinkImageValues { get; }
278+
public CommandLinkImageValues UACShieldIcon { get; }
277279

278280
private bool ShouldSerializeValues() => false;
279281

@@ -604,30 +606,14 @@ protected override void ContextMenuClosed()
604606
/// <inheritdoc />
605607
protected override void OnPaint(PaintEventArgs? e)
606608
{
607-
StateCommon.Content.LongText.Font = CommandLinkTextValues.DescriptionFont != null
608-
? CommandLinkTextValues.DescriptionFont
609-
: null;
610-
611-
StateCommon.Content.ShortText.Font =
612-
CommandLinkTextValues.HeadingFont != null
613-
? CommandLinkTextValues.HeadingFont
614-
: null;
615-
616-
StateCommon.Content.LongText.TextH = CommandLinkTextValues.DescriptionTextHAlignment != null
617-
? CommandLinkTextValues.DescriptionTextHAlignment ?? PaletteRelativeAlign.Near
618-
: PaletteRelativeAlign.Near;
619-
620-
StateCommon.Content.LongText.TextV = CommandLinkTextValues.DescriptionTextVAlignment != null
621-
? CommandLinkTextValues.DescriptionTextVAlignment ?? PaletteRelativeAlign.Far
622-
: PaletteRelativeAlign.Far;
623-
624-
StateCommon.Content.ShortText.TextH = CommandLinkTextValues.HeadingTextHAlignment != null
625-
? CommandLinkTextValues.HeadingTextHAlignment ?? PaletteRelativeAlign.Near
626-
: PaletteRelativeAlign.Near;
627-
628-
StateCommon.Content.ShortText.TextV = CommandLinkTextValues.HeadingTextVAlignment != null
629-
? CommandLinkTextValues.HeadingTextVAlignment ?? PaletteRelativeAlign.Center
630-
: PaletteRelativeAlign.Center;
609+
StateCommon.Content.LongText.Font = CommandLinkTextValues.DescriptionFont;
610+
StateCommon.Content.ShortText.Font = CommandLinkTextValues.HeadingFont;
611+
612+
StateCommon.Content.LongText.TextH = CommandLinkTextValues.DescriptionTextHAlignment;
613+
StateCommon.Content.LongText.TextV = CommandLinkTextValues.DescriptionTextVAlignment;
614+
615+
StateCommon.Content.ShortText.TextH = CommandLinkTextValues.HeadingTextHAlignment;
616+
StateCommon.Content.ShortText.TextV = CommandLinkTextValues.HeadingTextVAlignment;
631617

632618
base.OnPaint(e);
633619
}

Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonCommandLinkButtonActionList.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ public string Description
106106
/// </summary>
107107
public Image? Image
108108
{
109-
get => _button.CommandLinkImageValues.Image;
109+
get => _button.CommandLinkTextValues.Image;
110110

111111
set
112112
{
113-
if (_button.CommandLinkImageValues.Image != value)
113+
if (_button.CommandLinkTextValues.Image != value)
114114
{
115-
_service?.OnComponentChanged(_button, null, _button.CommandLinkImageValues.Image, value);
116-
_button.CommandLinkImageValues.Image = value;
115+
_service?.OnComponentChanged(_button, null, _button.CommandLinkTextValues.Image, value);
116+
_button.CommandLinkTextValues.Image = value;
117117
}
118118
}
119119
}

Source/Krypton Components/Krypton.Toolkit/Utilities/UACShieldIconSize.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ namespace Krypton.Toolkit;
1212
/// <summary>Defines the UAC shield image size for a <see cref="KryptonButton"/>.</summary>
1313
public enum UACShieldIconSize
1414
{
15-
// <summary>A custom image size.</summary>
16-
// Custom = 0,
1715
/// <summary>The extra small image size (16 x 16).</summary>
1816
ExtraSmall = 1,
1917
/// <summary>The small image size (32 x 32).</summary>

0 commit comments

Comments
 (0)