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();