From 9dfdb310ba7d477a86d598f3e8c212e980d1a7d2 Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 25 May 2023 13:43:08 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E9=87=8D=E6=9E=84=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Style/UIStyleManager.cs | 10 ++++++++++ SunnyUI/Style/UIStyles.cs | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/SunnyUI/Style/UIStyleManager.cs b/SunnyUI/Style/UIStyleManager.cs index 9c1e9f91..0036d3e8 100644 --- a/SunnyUI/Style/UIStyleManager.cs +++ b/SunnyUI/Style/UIStyleManager.cs @@ -21,6 +21,7 @@ ******************************************************************************/ using System.ComponentModel; +using static System.Drawing.FontConverter; namespace Sunny.UI { @@ -85,6 +86,15 @@ namespace Sunny.UI set => UIStyles.FontSize = value; } + [Editor("System.Drawing.Design.FontNameEditor", "System.Drawing.Design.UITypeEditor")] + [TypeConverter(typeof(FontNameConverter))] + [DefaultValue("微软雅黑")] + public string FontName + { + get => UIStyles.FontName; + set => UIStyles.FontName = value; + } + /// /// 版本 /// diff --git a/SunnyUI/Style/UIStyles.cs b/SunnyUI/Style/UIStyles.cs index d5c0a6bc..8b57b0c8 100644 --- a/SunnyUI/Style/UIStyles.cs +++ b/SunnyUI/Style/UIStyles.cs @@ -26,9 +26,11 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; +using static System.Drawing.FontConverter; namespace Sunny.UI { @@ -41,6 +43,10 @@ namespace Sunny.UI public static bool ZoomScale { get; set; } + [Editor("System.Drawing.Design.FontNameEditor", "System.Drawing.Design.UITypeEditor")] + [TypeConverter(typeof(FontNameConverter))] + public static string FontName { get; set; } = "微软雅黑"; + public static float FontSize { get; set; } = 12; private static readonly ConcurrentDictionary FontCharSets = new ConcurrentDictionary();