From 5b16bae03ffbb9250154eba8507e817c720d9f5d Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 19 Feb 2024 21:31:14 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIForm2:=20=E5=A2=9E=E5=8A=A0=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E9=A3=8E=E6=A0=BC=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Style/UIStyles.cs | 62 ++++++++++----------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/SunnyUI/Style/UIStyles.cs b/SunnyUI/Style/UIStyles.cs index cfa8e075..764d2f64 100644 --- a/SunnyUI/Style/UIStyles.cs +++ b/SunnyUI/Style/UIStyles.cs @@ -250,38 +250,6 @@ namespace Sunny.UI return (int)style; } - /// - /// 注册窗体 - /// - /// GUID - /// 窗体 - public static bool Register(Guid guid, UIForm form) - { - if (!Forms.ContainsKey(guid)) - { - Forms.Upsert(guid, form); - return true; - } - - return false; - } - - /// - /// 注册页面 - /// - /// GUID - /// 页面 - public static bool Register(Guid guid, UIPage page) - { - if (!Pages.ContainsKey(guid)) - { - Pages.Upsert(guid, page); - return true; - } - - return false; - } - /// /// 注册窗体 /// @@ -366,20 +334,6 @@ namespace Sunny.UI Pages.TryRemove(page.Guid, out _); } - /// - /// 反注册窗体、页面 - /// - /// GUID - public static void UnRegister(Guid guid) - { - if (Forms.ContainsKey(guid)) - Forms.TryRemove(guid, out _); - - if (Pages.ContainsKey(guid)) - Pages.TryRemove(guid, out _); - - } - /// /// 获取主题样式 /// @@ -428,6 +382,11 @@ namespace Sunny.UI form.SetInheritedStyle(style); } + foreach (var form in Forms2.Values) + { + form.SetInheritedStyle(style); + } + foreach (var page in Pages.Values) { page.SetInheritedStyle(style); @@ -447,6 +406,12 @@ namespace Sunny.UI form.SetDPIScale(); } + foreach (var form in Forms2.Values) + { + if (UIDPIScale.NeedSetDPIFont()) + form.SetDPIScale(); + } + foreach (var page in Pages.Values) { if (UIDPIScale.NeedSetDPIFont()) @@ -460,6 +425,11 @@ namespace Sunny.UI { form.Translate(); } + + foreach (var form in Forms2.Values) + { + form.Translate(); + } } } }