Skip to content

Commit

Permalink
* Fixed #1207
Browse files Browse the repository at this point in the history
  • Loading branch information
PWagner1 committed Dec 2, 2023
1 parent b100c8c commit 1842bac
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 409 deletions.
1 change: 1 addition & 0 deletions Documents/Help/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 [#1207](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1207), Microsoft 365 - Black (Dark Mode) Drop button is not visible
* Resolved [#1206](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1206), Remove the Font Size (as it is already covered by the actual font !)
* Resolved [#1197](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1197), `KryptonTaskDialog` Footer Images
* Resolved [#1189](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1189), The Context and Next/Pervious buttons of the `KryptonDockableNavigator` cannot be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public KryptonButton()
_overrideNormal,
_overrideTracking,
_overridePressed,
new PaletteMetricRedirect(Redirector),
new PaletteMetricRedirect(Redirector!),
this,
Orientation,
UseMnemonic)
Expand Down Expand Up @@ -810,7 +810,7 @@ protected override void OnPaint(PaintEventArgs? e)
}

// Draw an arrow in the correct location
PaintArrow(g, _dropDownRectangle);
PaintArrow(Values.DropDownArrowColor, g, _dropDownRectangle);

#endregion
}
Expand Down Expand Up @@ -920,7 +920,7 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv
switch (e.PropertyName)
{
case nameof(Enabled):
Enabled = KryptonCommand.Enabled;
Enabled = KryptonCommand!.Enabled;
break;
case nameof(Text):
case @"ExtraText":
Expand Down Expand Up @@ -968,21 +968,28 @@ private void SetCornerRoundingRadius(float? radius)

#region Splitter Stuff

private static void PaintArrow(Graphics graphics, Rectangle rectangle)
/// <summary>Paints the drop-down arrow.</summary>
/// <param name="graphics">The drop-down arrow graphics.</param>
/// <param name="rectangle">The drop-down rectangle area.</param>
private static void PaintArrow(Color? dropDownArrowColor, Graphics graphics, Rectangle rectangle)
{
var midPoint = new Point(Convert.ToInt32(rectangle.Left + rectangle.Width / 2),
Convert.ToInt32(rectangle.Top + rectangle.Height / 2));

midPoint.X += (rectangle.Width % 2);

Color color = dropDownArrowColor ?? Color.Black;

SolidBrush dropDownBrush = new SolidBrush(color);

var arrow = new Point[]
{
new Point(midPoint.X - 2, midPoint.Y - 1),
new Point(midPoint.X + 3, midPoint.Y - 1),
midPoint with { Y = midPoint.Y + 2 }
};

graphics.FillPolygon(SystemBrushes.ControlText, arrow);
graphics.FillPolygon(dropDownBrush, arrow);
}

private void ShowContextMenuStrip()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class KryptonColorButton : VisualSimpleBase, IButtonControl, IContentValu
private KryptonColorButtonCustomColorPreviewShape _customColorPreviewShape;

// Context menu items
private readonly KryptonContextMenu _kryptonContextMenu;
private readonly KryptonContextMenu? _kryptonContextMenu;
private readonly KryptonContextMenuSeparator _separatorTheme;
private readonly KryptonContextMenuSeparator _separatorStandard;
private readonly KryptonContextMenuSeparator _separatorRecent;
Expand Down Expand Up @@ -186,7 +186,7 @@ public KryptonColorButton()
_overrideNormal,
_overrideTracking,
_overridePressed,
new PaletteMetricRedirect(Redirector),
new PaletteMetricRedirect(Redirector!),
this,
VisualOrientation.Top,
UseMnemonic)
Expand Down Expand Up @@ -705,7 +705,7 @@ public virtual KryptonCommand? KryptonCommand
else
{
_wasEnabled = Enabled;
_wasImage = Values.Image;
_wasImage = Values.Image!;
}

_command = value;
Expand Down
27 changes: 27 additions & 0 deletions Source/Krypton Components/Krypton.Toolkit/Values/ButtonValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ButtonValues : Storage,
private UACShieldIconSize _uacShieldIconSize;
private Image? _image;
private Color _transparent;
private Color? _dropDownArrowColor;
private string? _text;
private string _extraText;

Expand All @@ -56,6 +57,7 @@ public ButtonValues(NeedPaintHandler needPaint)
// Set initial values
_image = null;
_transparent = Color.Empty;
_dropDownArrowColor = Color.Empty;
_text = _defaultText;
_extraText = _defaultExtraText;
_useAsDialogButton = false;
Expand All @@ -77,6 +79,7 @@ public ButtonValues(NeedPaintHandler needPaint)
(UseAsADialogButton == false) &&
(UseAsUACElevationButton == false) &&
(ShowSplitOption == false) &&
(DropDownArrowColor == Color.Empty) &&
//(UACShieldIconSize == UACShieldIconSize.ExtraSmall)
(ImageTransparentColor == Color.Empty) &&
(Text == _defaultText) &&
Expand Down Expand Up @@ -368,6 +371,30 @@ public bool ShowSplitOption

#endregion

#region DropDownArrowColor

/// <summary>Gets or sets the color of the drop down arrow.</summary>
/// <value>The color of the drop down arrow.</value>
[Category(@"Visuals")]
[Description(@"Sets the drop down arrow color.")]
[DefaultValue(typeof(Color), @"Empty")]
public Color? DropDownArrowColor
{
get => _dropDownArrowColor;

set
{
if (_dropDownArrowColor != null)
{
_dropDownArrowColor = value;

PerformNeedPaint(true);
}
}
}

#endregion

#region CreateImageStates
/// <summary>
/// Create the storage for the image states.
Expand Down
Loading

0 comments on commit 1842bac

Please sign in to comment.