* UIDigitalLabel: 增加DPI支持

This commit is contained in:
Sunny 2024-10-22 21:05:30 +08:00
parent e9ffd02edc
commit 49c9419590
2 changed files with 3 additions and 2 deletions

View File

@ -18,6 +18,7 @@
* *
* 2023-12-01: V3.6.1 * 2023-12-01: V3.6.1
* 2024-01-23: V3.6.3 * 2024-01-23: V3.6.3
* 2024-10-22: V3.7.2 DPI支持
******************************************************************************/ ******************************************************************************/
/****************************************************************************** /******************************************************************************
@ -102,7 +103,7 @@ namespace Sunny.UI
/// <param name="e">绘图参数</param> /// <param name="e">绘图参数</param>
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
using Font font = DigitalFont.Instance.GetFont(DigitalSize); using Font font = DigitalFont.Instance.GetFont(UIStyles.DPIScale ? DigitalSize / UIDPIScale.SystemDPIScale : DigitalSize);
using Brush br = new SolidBrush(ForeColor); using Brush br = new SolidBrush(ForeColor);
string text = Value.ToString("F" + DecimalPlaces); string text = Value.ToString("F" + DecimalPlaces);

View File

@ -31,7 +31,7 @@ namespace Sunny.UI
public static float DPIScale => UIStyles.GlobalFont ? SystemDPIScale * 100.0f / UIStyles.GlobalFontScale : SystemDPIScale; public static float DPIScale => UIStyles.GlobalFont ? SystemDPIScale * 100.0f / UIStyles.GlobalFontScale : SystemDPIScale;
private static float SystemDPIScale public static float SystemDPIScale
{ {
get get
{ {