From 49c941959086e539f6523426945c06c1fa080778 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 22 Oct 2024 21:05:30 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIDigitalLabel:=20=E5=A2=9E=E5=8A=A0DPI?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIDigitalLabel.cs | 3 ++- SunnyUI/Style/UIDPIScale.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SunnyUI/Controls/UIDigitalLabel.cs b/SunnyUI/Controls/UIDigitalLabel.cs index bb97dcd3..2a534b88 100644 --- a/SunnyUI/Controls/UIDigitalLabel.cs +++ b/SunnyUI/Controls/UIDigitalLabel.cs @@ -18,6 +18,7 @@ * * 2023-12-01: V3.6.1 增加文件说明 * 2024-01-23: V3.6.3 更新绘制 + * 2024-10-22: V3.7.2 增加DPI支持 ******************************************************************************/ /****************************************************************************** @@ -102,7 +103,7 @@ namespace Sunny.UI /// 绘图参数 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); string text = Value.ToString("F" + DecimalPlaces); diff --git a/SunnyUI/Style/UIDPIScale.cs b/SunnyUI/Style/UIDPIScale.cs index a83f6945..1b5f8f77 100644 --- a/SunnyUI/Style/UIDPIScale.cs +++ b/SunnyUI/Style/UIDPIScale.cs @@ -31,7 +31,7 @@ namespace Sunny.UI public static float DPIScale => UIStyles.GlobalFont ? SystemDPIScale * 100.0f / UIStyles.GlobalFontScale : SystemDPIScale; - private static float SystemDPIScale + public static float SystemDPIScale { get {