diff --git a/Documents/Help/Changelog.md b/Documents/Help/Changelog.md
index e291fb7de..320140078 100644
--- a/Documents/Help/Changelog.md
+++ b/Documents/Help/Changelog.md
@@ -3,6 +3,8 @@
=======
# 2025-02-01 - Build 2502 (Patch 5) - February 2025
+* Resolved [#565](https://github.com/Krypton-Suite/Standard-Toolkit/issues/565), GroupBox icons are not scaled for dpi awareness
+* Resolved [#559](https://github.com/Krypton-Suite/Standard-Toolkit/issues/559), Header group icon is not scaled for dpi awareness
* Resolved [#1946](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1946), ButtonSpecs do not scale anymore!
* Resolved [#1890](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1890), V85 codebase: Exception thrown for colouring a ribbon
* Resolved [#1905](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1905), `Sparkle` Themes have an issue with the Background
diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs
index 9895250a4..7a4d81dda 100644
--- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs
+++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs
@@ -35,7 +35,7 @@ protected ButtonSpecNavFixed([DisallowNull] KryptonNavigator navigator,
Debug.Assert(navigator != null);
// Remember back reference to owning navigator.
- Navigator = navigator;
+ Navigator = navigator!;
// Fix the type
ProtectedType = fixedStyle;
diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavRemap.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavRemap.cs
index f06ed1843..a087ce971 100644
--- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavRemap.cs
+++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavRemap.cs
@@ -134,7 +134,7 @@ public ButtonSpecNavRemap(PaletteBase? target,
{
Debug.Assert(buttonSpec != null);
- _buttonSpec = buttonSpec;
+ _buttonSpec = buttonSpec!;
_remapTarget = remapTarget;
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs b/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs
index 0b610fca9..656d78ae7 100644
--- a/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs
@@ -77,7 +77,7 @@ public DragViewController([DisallowNull] ViewBase target)
MousePoint = CommonHelper.NullPoint;
AllowDragging = true;
_dragging = false;
- Target = target;
+ Target = target!;
_lastClick = DateTime.Now.AddDays(-1);
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedback.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedback.cs
index f95992647..f110591be 100644
--- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedback.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedback.cs
@@ -87,7 +87,7 @@ public virtual void Start([DisallowNull] IPaletteDragDrop paletteDragDrop,
Debug.Assert(pageDragEndData != null);
Debug.Assert(dragTargets != null);
- PaletteDragDrop = paletteDragDrop;
+ PaletteDragDrop = paletteDragDrop!;
Renderer = renderer;
PageDragEndData = pageDragEndData;
DragTargets = dragTargets;
diff --git a/Source/Krypton Components/Krypton.Navigator/General/PageToToolTipMapping.cs b/Source/Krypton Components/Krypton.Navigator/General/PageToToolTipMapping.cs
index d8452e07f..cba50d6bd 100644
--- a/Source/Krypton Components/Krypton.Navigator/General/PageToToolTipMapping.cs
+++ b/Source/Krypton Components/Krypton.Navigator/General/PageToToolTipMapping.cs
@@ -39,7 +39,7 @@ public PageToToolTipMapping([DisallowNull] KryptonPage page,
{
Debug.Assert(page != null);
- _page = page;
+ _page = page!;
_mapImage = mapImage;
_mapText = mapText;
_mapExtraText = mapExtraText;
diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs
index 62525080d..97d3f1840 100644
--- a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs
@@ -26,17 +26,18 @@ public abstract class HeaderGroupMappingBase : HeaderValuesBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderGroupMappingBase class.
///
/// Reference to owning navigator instance.
/// Delegate for notifying paint requests.
+ ///
protected HeaderGroupMappingBase([DisallowNull] KryptonNavigator navigator,
- NeedPaintHandler needPaint)
- : base(needPaint)
+ NeedPaintHandler needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
Debug.Assert(navigator != null);
-
// Remember back reference to owning control
_navigator = navigator;
@@ -45,6 +46,7 @@ protected HeaderGroupMappingBase([DisallowNull] KryptonNavigator navigator,
_mapHeading = GetMapHeadingDefault();
_mapDescription = GetMapDescriptionDefault();
}
+
#endregion
#region Default Values
diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingPrimary.cs b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingPrimary.cs
index 3b870075b..b8c81f70e 100644
--- a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingPrimary.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingPrimary.cs
@@ -22,14 +22,17 @@ public class HeaderGroupMappingPrimary : HeaderGroupMappingBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderGroupMappingPrimary class.
///
/// Reference to owning navigator instance.
/// Delegate for notifying paint requests.
+ ///
public HeaderGroupMappingPrimary(KryptonNavigator navigator,
- NeedPaintHandler needPaint)
- : base(navigator, needPaint)
+ NeedPaintHandler needPaint,
+ GetDpiFactor getDpiFactor)
+ : base(navigator, needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingSecondary.cs b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingSecondary.cs
index 053576874..d754600e4 100644
--- a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingSecondary.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingSecondary.cs
@@ -22,14 +22,17 @@ public class HeaderGroupMappingSecondary : HeaderGroupMappingBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderGroupMappingSecondary class.
///
/// Reference to owning navigator instance.
/// Delegate for notifying paint requests.
+ ///
public HeaderGroupMappingSecondary(KryptonNavigator navigator,
- NeedPaintHandler needPaint)
- : base(navigator, needPaint)
+ NeedPaintHandler needPaint,
+ GetDpiFactor getDpiFactor)
+ : base(navigator, needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs
index 11bc2fd27..66f83a93b 100644
--- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs
@@ -59,7 +59,7 @@ public NavigatorBar([DisallowNull] KryptonNavigator navigator,
Debug.Assert(navigator != null);
// Remember back reference
- _navigator = navigator;
+ _navigator = navigator!;
// Store the provided paint notification delegate
NeedPaint = needPaint;
diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorHeader.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorHeader.cs
index 8e9498347..caeae7080 100644
--- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorHeader.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorHeader.cs
@@ -11,6 +11,8 @@
#endregion
// ReSharper disable VirtualMemberCallInConstructor
+using static Krypton.Toolkit.HeaderValuesBase;
+
namespace Krypton.Navigator
{
///
@@ -59,9 +61,15 @@ public NavigatorHeader([DisallowNull] KryptonNavigator navigator,
_headerVisiblePrimary = true;
_headerVisibleSecondary = true;
_headerVisibleBar = true;
- HeaderValuesPrimary = new HeaderGroupMappingPrimary(_navigator, needPaint);
- HeaderValuesSecondary = new HeaderGroupMappingSecondary(_navigator, needPaint);
+ HeaderValuesPrimary = new HeaderGroupMappingPrimary(_navigator, needPaint, GetDpiFactor);
+ HeaderValuesSecondary = new HeaderGroupMappingSecondary(_navigator, needPaint, GetDpiFactor);
}
+
+ private float GetDpiFactor()
+ {
+ return _navigator.DeviceDpi / 96F;
+ }
+
#endregion
#region IsDefault
diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs
index 5e75d99fe..0d154973a 100644
--- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs
+++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs
@@ -12,6 +12,8 @@
*/
#endregion
+using static Krypton.Toolkit.HeaderValuesBase;
+
namespace Krypton.Ribbon
{
///
@@ -40,8 +42,15 @@ public abstract class KryptonRibbonGroupItem : Component,
/// Initialise a new instance of the KryptonRibbonGroupItem class.
///
protected KryptonRibbonGroupItem() =>
- // Do the Tooltip Magic
- _toolTipValues = new ToolTipValues(null/*NeedPaintDelegate*/); // Must be replaced by appropriate call
+ // Do the Tooltip Magic
+ _toolTipValues = new ToolTipValues(null/*NeedPaintDelegate*/, GetDpiFactor); // Must be replaced by appropriate call
+
+ private float GetDpiFactor()
+ {
+ return (Ribbon != null)
+ ? Ribbon.DeviceDpi / 96F
+ : 1.0f;
+ }
#endregion Identity
diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs
index 963dffebb..b188a3c15 100644
--- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs
+++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs
@@ -12,6 +12,8 @@
*/
#endregion
+using static Krypton.Toolkit.HeaderValuesBase;
+
namespace Krypton.Ribbon
{
///
@@ -537,12 +539,19 @@ private void CreateViewElements(PaletteRedirect? redirect)
NeedPaintDelegate);
// Create the manager for handling tooltips
- ToolTipManager = new ToolTipManager(new ToolTipValues(null)); // use default, as each button "could" have different values ??!!??
+ ToolTipManager = new ToolTipManager(new ToolTipValues(null, GetDpiFactor)); // use default, as each button "could" have different values ??!!??
ToolTipManager.ShowToolTip += OnShowToolTip;
ToolTipManager.CancelToolTip += OnCancelToolTip;
ButtonSpecManager.ToolTipManager = ToolTipManager;
}
+ private float GetDpiFactor()
+ {
+ return (_visualPopupToolTip != null)
+ ? _visualPopupToolTip.DeviceDpi / 96F
+ : 1F;
+ }
+
private void SetupParentMonitoring()
{
// We have to know when the parent of the ribbon changes so we can then hook
diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs
index 1b9675bab..c7d88ef60 100644
--- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs
@@ -21,7 +21,7 @@ public abstract class KryptonContextMenuItemBase : Component, INotifyPropertyCha
#region Instance Fields
private bool _visible;
- private ToolTipValues _toolTipValues = new ToolTipValues(null);
+ private ToolTipValues _toolTipValues;
private VisualPopupToolTip? _visualPopupToolTip;
private IContextMenuProvider _provider;
#endregion
@@ -49,11 +49,19 @@ public abstract class KryptonContextMenuItemBase : Component, INotifyPropertyCha
protected KryptonContextMenuItemBase()
{
_visible = true;
+ _toolTipValues = new ToolTipValues(null, GetDpiFactor);
ToolTipManager = new ToolTipManager(_toolTipValues);
ToolTipManager.ShowToolTip += OnShowToolTip;
ToolTipManager.CancelToolTip += OnCancelToolTip;
}
+ private float GetDpiFactor()
+ {
+ return (_visualPopupToolTip != null)
+ ? _visualPopupToolTip.DeviceDpi / 96F
+ : 1F;
+ }
+
#endregion
#region Public
diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs
index bcca89211..eb8b56e69 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs
@@ -178,7 +178,7 @@ public KryptonForm()
OnButtonManagerNeedPaint!);
// Create the manager for handling tooltips
- ToolTipManager = new ToolTipManager(new ToolTipValues(null)); // use default, as each button "could" have different values ??!!??
+ ToolTipManager = new ToolTipManager(new ToolTipValues(null, GetDpiFactor)); // use default, as each button "could" have different values ??!!??
ToolTipManager.ShowToolTip += OnShowToolTip;
ToolTipManager.CancelToolTip += OnCancelToolTip;
_buttonManager.ToolTipManager = ToolTipManager;
@@ -201,6 +201,13 @@ public KryptonForm()
#pragma warning restore CS0618
}
+ private float GetDpiFactor()
+ {
+ return (_visualPopupToolTip != null)
+ ? _visualPopupToolTip.DeviceDpi / 96F
+ : 1F;
+ }
+
///
/// Releases all resources used by the Control.
///
diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs
index 7878c5c2d..ad3f7e70f 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs
@@ -56,7 +56,7 @@ public KryptonGroupBox()
_captionVisible = true;
// Create storage objects
- Values = new CaptionValues(NeedPaintDelegate);
+ Values = new CaptionValues(NeedPaintDelegate, GetDpiFactor);
Values.TextChanged += OnValuesTextChanged;
// Create the palette storage
@@ -67,11 +67,9 @@ public KryptonGroupBox()
// Create the internal panel used for containing content
Panel = new KryptonGroupBoxPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint!)
{
-
// Make sure the panel back style always mimics our back style
PanelBackStyle = PaletteBackStyle.ControlGroupBox
};
-
_drawContent = new ViewDrawContent(StateNormal.Content, Values, VisualOrientation.Top);
// Create view for the control border and background
@@ -108,6 +106,13 @@ public KryptonGroupBox()
_cornerRoundingRadius = GlobalStaticValues.PRIMARY_CORNER_ROUNDING_VALUE;
}
+ private float GetDpiFactor()
+ {
+ return (Panel != null)
+ ? Panel.DeviceDpi / 96F
+ : 1f;
+ }
+
///
/// Clean up any resources being used.
///
diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs
index fb0b983ba..28c28c1cb 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs
@@ -71,7 +71,7 @@ public KryptonHeader()
AllowButtonSpecToolTipPriority = false;
// Create storage objects
- Values = new HeaderValues(NeedPaintDelegate);
+ Values = new HeaderValues(NeedPaintDelegate, GetDpiFactor);
Values.TextChanged += OnHeaderTextChanged;
ButtonSpecs = new HeaderButtonSpecCollection(this);
@@ -110,6 +110,11 @@ public KryptonHeader()
_cornerRoundingRadius = GlobalStaticValues.PRIMARY_CORNER_ROUNDING_VALUE;
}
+ private float GetDpiFactor()
+ {
+ return DeviceDpi / 96F;
+ }
+
///
/// Clean up any resources being used.
///
diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs
index fe5634f1c..b6a21e05f 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs
@@ -102,9 +102,9 @@ public KryptonHeaderGroup()
_visibleSecondary = true;
// Create storage objects
- ValuesPrimary = new HeaderGroupValuesPrimary(NeedPaintDelegate);
+ ValuesPrimary = new HeaderGroupValuesPrimary(NeedPaintDelegate, GetDpiFactor);
ValuesPrimary.TextChanged += OnHeaderGroupTextChanged;
- ValuesSecondary = new HeaderGroupValuesSecondary(NeedPaintDelegate);
+ ValuesSecondary = new HeaderGroupValuesSecondary(NeedPaintDelegate, GetDpiFactor);
ButtonSpecs = new HeaderGroupButtonSpecCollection(this);
// We need to monitor button spec click events
@@ -208,6 +208,13 @@ public KryptonHeaderGroup()
_headerSecondaryCornerRoundingRadius = GlobalStaticValues.SECONDARY_CORNER_ROUNDING_VALUE;
}
+ private float GetDpiFactor()
+ {
+ return (Panel != null)
+ ? Panel.DeviceDpi / 96F
+ : 1f;
+ }
+
///
/// Clean up any resources being used.
///
diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs
index a765e4d93..7aa6a2e1d 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs
@@ -118,7 +118,7 @@ protected VisualControlBase()
AttachGlobalEvents();
// Do the Tooltip Magic
- ToolTipValues = new ToolTipValues(NeedPaintDelegate);
+ ToolTipValues = new ToolTipValues(NeedPaintDelegate, GetDpiFactor);
// Create the manager for handling tooltips
// ReSharper disable once UseObjectOrCollectionInitializer
_toolTipManager = new ToolTipManager(ToolTipValues);
@@ -126,6 +126,11 @@ protected VisualControlBase()
_toolTipManager.CancelToolTip += OnCancelToolTip;
}
+ private float GetDpiFactor()
+ {
+ return DeviceDpi / 96F;
+ }
+
///
/// Clean up any resources being used.
///
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/CaptionValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/CaptionValues.cs
index 5f1fa05b0..4deac329b 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/CaptionValues.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/CaptionValues.cs
@@ -22,12 +22,14 @@ public class CaptionValues : HeaderValuesBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the CaptionValues class.
///
/// Delegate for notifying paint requests.
- public CaptionValues(NeedPaintHandler needPaint)
- : base(needPaint)
+ ///
+ public CaptionValues(NeedPaintHandler needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesPrimary.cs b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesPrimary.cs
index f93bb77c7..e2ce78dea 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesPrimary.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesPrimary.cs
@@ -22,12 +22,14 @@ public class HeaderGroupValuesPrimary : HeaderValuesBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderGroupValuesPrimary class.
///
/// Delegate for notifying paint requests.
- public HeaderGroupValuesPrimary(NeedPaintHandler needPaint)
- : base(needPaint)
+ ///
+ public HeaderGroupValuesPrimary(NeedPaintHandler needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesSecondary.cs b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesSecondary.cs
index 00e19a0bc..6dc605181 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesSecondary.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderGroupValuesSecondary.cs
@@ -22,12 +22,14 @@ public class HeaderGroupValuesSecondary : HeaderValuesBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderGroupValuesSecondary class.
///
/// Delegate for notifying paint requests.
- public HeaderGroupValuesSecondary(NeedPaintHandler needPaint)
- : base(needPaint)
+ ///
+ public HeaderGroupValuesSecondary(NeedPaintHandler needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValues.cs
index e60f86e0e..caacba047 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValues.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValues.cs
@@ -23,12 +23,14 @@ public class HeaderValues : HeaderValuesBase
#endregion
#region Identity
+
///
/// Initialize a new instance of the HeaderValues class.
///
/// Delegate for notifying paint requests.
- public HeaderValues(NeedPaintHandler? needPaint)
- : base(needPaint)
+ ///
+ public HeaderValues(NeedPaintHandler? needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
}
#endregion
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs
index 25e3e7e80..ab94d9994 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs
@@ -18,6 +18,8 @@ namespace Krypton.Toolkit
public abstract class HeaderValuesBase : Storage,
IContentValues
{
+ private readonly GetDpiFactor _getDpiFactor;
+
#region Static Fields
private static readonly Image _defaultImage = GenericImageResources.KryptonLogoGeneric;
#endregion
@@ -35,14 +37,24 @@ public abstract class HeaderValuesBase : Storage,
///
public event EventHandler? TextChanged;
#endregion
-
+
+ #region Delegates
+ ///
+ /// Signature of method that is called when Image scaling is required.
+ ///
+ public delegate float GetDpiFactor();
+ #endregion
+
#region Identity
+
///
/// Initialize a new instance of the HeaderValuesBase class.
///
/// Delegate for notifying paint requests.
- protected HeaderValuesBase(NeedPaintHandler? needPaint)
+ ///
+ protected HeaderValuesBase(NeedPaintHandler? needPaint, GetDpiFactor getDpiFactor)
{
+ _getDpiFactor = getDpiFactor;
// Store the provided paint notification delegate
NeedPaint = needPaint;
@@ -108,19 +120,26 @@ public Image? Image
}
}
- private bool ShouldSerializeImage() => Image != GetImageDefault();
+ private bool ShouldSerializeImage() => _image != GetImageDefault();
///
/// Resets the Image property to its default value.
///
- public void ResetImage() => Image = GetImageDefault();
+ public void ResetImage() => _image = GetImageDefault();
///
/// Gets the content image.
///
/// The state for which the image is needed.
/// Image value.
- public virtual Image? GetImage(PaletteState state) => Image;
+ public virtual Image? GetImage(PaletteState state)
+ {
+ float dpiFactor = _getDpiFactor();
+ return (_image != null)
+ ? CommonHelper.ScaleImageForSizedDisplay(_image, _image.Width * dpiFactor,
+ _image.Height * dpiFactor)
+ : null;
+ }
#endregion
diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ToolTipValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ToolTipValues.cs
index 800c39cac..0db5f7f75 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Values/ToolTipValues.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Values/ToolTipValues.cs
@@ -27,8 +27,9 @@ public class ToolTipValues : HeaderValues
///
///
///
- public ToolTipValues(NeedPaintHandler? needPaint)
- : base(needPaint)
+ ///
+ public ToolTipValues(NeedPaintHandler? needPaint, GetDpiFactor getDpiFactor)
+ : base(needPaint, getDpiFactor)
{
ResetToolTipStyle();
ToolTipPosition = new PopupPositionValues();
diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs
index bc5ce73e6..245688e05 100644
--- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs
@@ -104,7 +104,7 @@ public ViewLayoutMonths(IContextMenuProvider provider,
Calendar.GetToolStripDelegate, _needPaintDelegate);
// Create the manager for handling tooltips
- _toolTipManager = new ToolTipManager(new ToolTipValues(null)); // use default, as each button "could" have different values ??!!??
+ _toolTipManager = new ToolTipManager(new ToolTipValues(null, GetDpiFactor)); // use default, as each button "could" have different values ??!!??
_toolTipManager.ShowToolTip += OnShowToolTip;
_toolTipManager.CancelToolTip += OnCancelToolTip;
ButtonManager.ToolTipManager = _toolTipManager;
@@ -125,6 +125,13 @@ public ViewLayoutMonths(IContextMenuProvider provider,
_drawHeader.Add(_drawToday, ViewDockStyle.Left);
}
+ private float GetDpiFactor()
+ {
+ return (_visualPopupToolTip != null)
+ ? _visualPopupToolTip.DeviceDpi / 96F
+ : 1F;
+ }
+
///
/// Obtains the String representation of this instance.
///