* UIStyle: 增加全局字体大小设置

This commit is contained in:
Sunny 2022-04-03 10:38:45 +08:00
parent c9b6653ad1
commit 017c49a2f7
4 changed files with 10 additions and 1 deletions

Binary file not shown.

View File

@ -29,7 +29,7 @@ namespace Sunny.UI
{
public static float DPIScale()
{
return GDI.Graphics().DpiX / 96.0f;
return GDI.Graphics().DpiX / 96.0f / (UIStyles.FontSize / 12.0f);
}
public static bool DPIScaleIsOne()

View File

@ -154,6 +154,8 @@ namespace Sunny.UI
{
public static bool DPIScale { get; set; }
public static float FontSize { get; set; } = 12;
public static List<UIStyle> PopularStyles()
{
List<UIStyle> styles = new List<UIStyle>();

View File

@ -75,5 +75,12 @@ namespace Sunny.UI
get => UIStyles.DPIScale;
set => UIStyles.DPIScale = value;
}
[DefaultValue(12f), Description("DPI缩放开启后可调字体大小默认12"), Category("SunnyUI")]
public float FontSize
{
get => UIStyles.FontSize;
set => UIStyles.FontSize = value;
}
}
}