Skip to content

Commit

Permalink
Merge pull request #1219 from Krypton-Suite/1216-feature-request-add-…
Browse files Browse the repository at this point in the history
…support-for-fonts

* Partly implement #1204
  • Loading branch information
Smurf-IV authored Dec 8, 2023
2 parents 3006ee0 + 9e22507 commit 306f0a0
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 80 deletions.
5 changes: 4 additions & 1 deletion Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
=======

## 2024-11-xx - Build 2411 - November 2024
* Implemented [#1204](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1204), Build on `KryptonCommandLinkButtons`
- [#1216](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1216), Add support for fonts
- [#1217](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1217), Add support for text alignment
* Resolved [#996](https://github.com/Krypton-Suite/Standard-Toolkit/issues/996), DataGridView ComboBox Adding list over and over
* 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
* Implement [#1187](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1187), Bring over the `KryptonCommandLinkButtons`
* Implemented [#1187](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1187), Bring over the `KryptonCommandLinkButtons`
* Resolved [#1176](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1176), KryptonProgressBar: small values escape drawing area
* Resolved [#1169](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1169), Button Spec Krypton Context Menu (Canary)
* Implemented [#1166](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1166), Use a struct to contain `KryptonMessageBox` data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2023 - 2023. All rights reserved.
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ private void SetCornerRoundingRadius(float? radius)
/// <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>
/// <param name="dropDownArrowColor">The color of the drop-down arrow.</param>
private static void PaintArrow(Color? dropDownArrowColor, Graphics graphics, Rectangle rectangle)
{
var midPoint = new Point(Convert.ToInt32(rectangle.Left + rectangle.Width / 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2023 - 2023. All rights reserved.
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion
Expand Down Expand Up @@ -75,6 +75,7 @@ public KryptonCommandLinkButton()

// Create content storage
CommandLinkImageValues = new CommandLinkImageValues(NeedPaintDelegate);
CommandLinkImageValues.Image = CommandLinkImageResources.Windows_11_CommandLink_Arrow;
CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate);

// Create the palette storage
Expand Down Expand Up @@ -182,19 +183,14 @@ public override string Text
set => CommandLinkTextValues.Heading = value;
}

private bool ShouldSerializeText()
{
private bool ShouldSerializeText() =>
// Never serialize, let the button values serialize instead
return false;
}
false;

/// <summary>
/// Resets the Text property to its default value.
/// </summary>
public override void ResetText()
{
CommandLinkTextValues.ResetText();
}
public override void ResetText() => CommandLinkTextValues.ResetText();

/// <summary>
/// Gets and sets the visual orientation of the control.
Expand Down Expand Up @@ -240,15 +236,9 @@ public ButtonStyle ButtonStyle
}
}

private bool ShouldSerializeButtonStyle()
{
return (ButtonStyle != ButtonStyle.Command);
}
private bool ShouldSerializeButtonStyle() => (ButtonStyle != ButtonStyle.Command);

private void ResetButtonStyle()
{
ButtonStyle = ButtonStyle.Command;
}
private void ResetButtonStyle() => ButtonStyle = ButtonStyle.Command;

/// <summary>
/// Gets access to the button content.
Expand All @@ -266,10 +256,7 @@ private void ResetButtonStyle()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public CommandLinkImageValues CommandLinkImageValues { get; }

private bool ShouldSerializeValues()
{
return false;
}
private bool ShouldSerializeValues() => false;

/// <summary>
/// Gets access to the common button appearance that other states can override.
Expand All @@ -279,10 +266,7 @@ private bool ShouldSerializeValues()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTripleRedirect StateCommon { get; }

private bool ShouldSerializeStateCommon()
{
return !StateCommon.IsDefault;
}
private bool ShouldSerializeStateCommon() => !StateCommon.IsDefault;

/// <summary>
/// Gets access to the disabled button appearance entries.
Expand All @@ -292,10 +276,7 @@ private bool ShouldSerializeStateCommon()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTriple StateDisabled { get; }

private bool ShouldSerializeStateDisabled()
{
return !StateDisabled.IsDefault;
}
private bool ShouldSerializeStateDisabled() => !StateDisabled.IsDefault;

/// <summary>
/// Gets access to the normal button appearance entries.
Expand All @@ -305,10 +286,7 @@ private bool ShouldSerializeStateDisabled()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTriple StateNormal { get; }

private bool ShouldSerializeStateNormal()
{
return !StateNormal.IsDefault;
}
private bool ShouldSerializeStateNormal() => !StateNormal.IsDefault;

/// <summary>
/// Gets access to the hot tracking button appearance entries.
Expand All @@ -318,10 +296,7 @@ private bool ShouldSerializeStateNormal()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTriple StateTracking { get; }

private bool ShouldSerializeStateTracking()
{
return !StateTracking.IsDefault;
}
private bool ShouldSerializeStateTracking() => !StateTracking.IsDefault;

/// <summary>
/// Gets access to the pressed button appearance entries.
Expand All @@ -331,10 +306,7 @@ private bool ShouldSerializeStateTracking()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTriple StatePressed { get; }

private bool ShouldSerializeStatePressed()
{
return !StatePressed.IsDefault;
}
private bool ShouldSerializeStatePressed() => !StatePressed.IsDefault;

/// <summary>
/// Gets access to the normal button appearance when default.
Expand All @@ -344,10 +316,7 @@ private bool ShouldSerializeStatePressed()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTripleRedirect OverrideDefault { get; }

private bool ShouldSerializeOverrideDefault()
{
return !OverrideDefault.IsDefault;
}
private bool ShouldSerializeOverrideDefault() => !OverrideDefault.IsDefault;

/// <summary>
/// Gets access to the button appearance when it has focus.
Expand All @@ -357,10 +326,7 @@ private bool ShouldSerializeOverrideDefault()
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PaletteTripleRedirect OverrideFocus { get; }

private bool ShouldSerializeOverrideFocus()
{
return !OverrideFocus.IsDefault;
}
private bool ShouldSerializeOverrideFocus() => !OverrideFocus.IsDefault;

/// <summary>
/// Gets or sets the value returned to the parent form when the button is clicked.
Expand Down Expand Up @@ -469,7 +435,7 @@ public virtual void SetFixedState(PaletteState state)
{
if (state == PaletteState.NormalDefaultOverride)
{
// Setup the overrides correctly to match state
// Set up the overrides correctly to match state
_overrideFocus.Apply = true;
_overrideNormal.Apply = true;

Expand Down Expand Up @@ -499,7 +465,7 @@ public virtual void SetFixedState(PaletteState state)
/// <summary>
/// Gets the default size of the control.
/// </summary>
protected override Size DefaultSize => new Size(287, 61);
protected override Size DefaultSize => new Size(319, 61);

/// <summary>
/// Gets the default Input Method Editor (IME) mode supported by this control.
Expand Down Expand Up @@ -618,11 +584,30 @@ protected override void ContextMenuClosed()
/// <inheritdoc />
protected override void OnPaint(PaintEventArgs? e)
{
//if (CommandLinkImageValues.ShowUACShield)
//{
// SendMessage(new HandleRef(this, Handle), BCM_SETSHIELD, IntPtr.Zero,
// CommandLinkImageValues.ShowUACShield);
//}
StateCommon.Content.LongText.Font = CommandLinkTextValues.DescriptionFont != null
? CommandLinkTextValues.DescriptionFont
: null;

StateCommon.Content.ShortText.Font =
CommandLinkTextValues.HeadingFont != null
? CommandLinkTextValues.HeadingFont
: null;

StateCommon.Content.LongText.TextH = CommandLinkTextValues.DescriptionTextHAlignment != null
? CommandLinkTextValues.DescriptionTextHAlignment ?? PaletteRelativeAlign.Near
: PaletteRelativeAlign.Near;

StateCommon.Content.LongText.TextV = CommandLinkTextValues.DescriptionTextVAlignment != null
? CommandLinkTextValues.DescriptionTextVAlignment ?? PaletteRelativeAlign.Far
: PaletteRelativeAlign.Far;

StateCommon.Content.ShortText.TextH = CommandLinkTextValues.HeadingTextHAlignment != null
? CommandLinkTextValues.HeadingTextHAlignment ?? PaletteRelativeAlign.Near
: PaletteRelativeAlign.Near;

StateCommon.Content.ShortText.TextV = CommandLinkTextValues.HeadingTextVAlignment != null
? CommandLinkTextValues.HeadingTextVAlignment ?? PaletteRelativeAlign.Center
: PaletteRelativeAlign.Center;

base.OnPaint(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
global using Krypton.Toolkit.ResourceFiles.Arrows;
global using Krypton.Toolkit.ResourceFiles.ButtonSpecs;
global using Krypton.Toolkit.ResourceFiles.CheckBoxes;
global using Krypton.Toolkit.ResourceFiles.CommandLink;
global using Krypton.Toolkit.ResourceFiles.ControlBox;
global using Krypton.Toolkit.ResourceFiles.Dialogs;
global using Krypton.Toolkit.ResourceFiles.DropDown;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>ColourScaleImageResources.resx</DependentUpon>
</Compile>
<Compile Update="ResourceFiles\CommandLink\CommandLinkImageResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>CommandLinkImageResources.resx</DependentUpon>
</Compile>
<Compile Update="ResourceFiles\ControlBox\Microsoft365ControlBoxResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -633,6 +638,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ColourScaleImageResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="ResourceFiles\CommandLink\CommandLinkImageResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>CommandLinkImageResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="ResourceFiles\ControlBox\Microsoft365ControlBoxResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Microsoft365ControlBoxResources.Designer.cs</LastGenOutput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public virtual PaletteTextHotkeyPrefix Prefix
}
}
#endregion

#region TextH
/// <summary>
/// Gets the horizontal relative alignment of the text.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 306f0a0

Please sign in to comment.