* 重构字体

This commit is contained in:
Sunny 2023-05-25 13:43:08 +08:00
parent 7ae4bb613d
commit 9dfdb310ba
2 changed files with 16 additions and 0 deletions

View File

@ -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;
}
/// <summary>
/// 版本
/// </summary>

View File

@ -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<string, byte> FontCharSets = new ConcurrentDictionary<string, byte>();