From ef52687e987cc393509c42610726a2011d64d2d1 Mon Sep 17 00:00:00 2001 From: Sunny Date: Sun, 12 Nov 2023 22:05:11 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E9=87=8D=E6=9E=84=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIFlowLayoutPanel.cs | 16 +++++++--------- SunnyUI/Controls/UIGifAvatar.cs | 2 ++ SunnyUI/Controls/UIUserControl.cs | 2 +- SunnyUI/Forms/UIForm.cs | 3 +++ SunnyUI/Frames/UIPage.cs | 3 +++ SunnyUI/Style/UIStyle.cs | 5 ++--- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/SunnyUI/Controls/UIFlowLayoutPanel.cs b/SunnyUI/Controls/UIFlowLayoutPanel.cs index 0e7c9587..2b4195c2 100644 --- a/SunnyUI/Controls/UIFlowLayoutPanel.cs +++ b/SunnyUI/Controls/UIFlowLayoutPanel.cs @@ -239,15 +239,7 @@ namespace Sunny.UI public void Add(Control control) { - if (control is IStyleInterface ctrl) - { - if (!ctrl.StyleCustomMode) ctrl.Style = Style; - } - - if (Panel != null) - { - Panel.Controls.Add(control); - } + Panel?.Controls.Add(control); } public void Clear() @@ -321,6 +313,12 @@ namespace Sunny.UI { } + //public override void SetInheritedStyle(UIStyle style) + //{ + // UIStyleHelper.SetChildUIStyle(this, style); + // base.SetInheritedStyle(style); + //} + /// /// 设置主题样式 /// diff --git a/SunnyUI/Controls/UIGifAvatar.cs b/SunnyUI/Controls/UIGifAvatar.cs index 6378a8b4..5cff6b73 100644 --- a/SunnyUI/Controls/UIGifAvatar.cs +++ b/SunnyUI/Controls/UIGifAvatar.cs @@ -18,6 +18,7 @@ * * 2022-07-01: V3.2.0 增加文件说明 * 2022-07-25: V3.2.2 重写图片刷新流程,减少内存及GC + * 2023-11-12: V3.5.2 重构主题 ******************************************************************************/ using System; @@ -77,6 +78,7 @@ namespace Sunny.UI { fillColor = uiColor.PanelFillColor; rectColor = uiColor.PanelFillColor; + CalcImages(); } [DefaultValue(null)] diff --git a/SunnyUI/Controls/UIUserControl.cs b/SunnyUI/Controls/UIUserControl.cs index b709502a..ece0b1d9 100644 --- a/SunnyUI/Controls/UIUserControl.cs +++ b/SunnyUI/Controls/UIUserControl.cs @@ -633,7 +633,7 @@ namespace Sunny.UI _style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom; } - public void SetInheritedStyle(UIStyle style) + public virtual void SetInheritedStyle(UIStyle style) { SetStyle(style); _style = UIStyle.Inherited; diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index f67d5c80..648f74fb 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -1380,6 +1380,9 @@ namespace Sunny.UI if (!DesignMode && UIStyles.Style.IsValid()) { Style = UIStyles.Style; + this.SuspendLayout(); + UIStyleHelper.SetChildUIStyle(this, UIStyles.Style); + this.ResumeLayout(); } } diff --git a/SunnyUI/Frames/UIPage.cs b/SunnyUI/Frames/UIPage.cs index c643adc8..06808fc8 100644 --- a/SunnyUI/Frames/UIPage.cs +++ b/SunnyUI/Frames/UIPage.cs @@ -293,6 +293,9 @@ namespace Sunny.UI if (!DesignMode && UIStyles.Style.IsValid()) { Style = UIStyles.Style; + this.SuspendLayout(); + UIStyleHelper.SetChildUIStyle(this, UIStyles.Style); + this.ResumeLayout(); } } diff --git a/SunnyUI/Style/UIStyle.cs b/SunnyUI/Style/UIStyle.cs index 4d20b83f..d72a3c88 100644 --- a/SunnyUI/Style/UIStyle.cs +++ b/SunnyUI/Style/UIStyle.cs @@ -440,9 +440,8 @@ namespace Sunny.UI if (obj is UIPage) continue; if (obj is UITableLayoutPanel) continue; - if (obj is UIFlowLayoutPanel) continue; - if (obj is UIUserControl) continue; - + //if (obj is UIFlowLayoutPanel) continue; + //if (obj is UIUserControl) continue; if (obj is TableLayoutPanel) continue; if (obj.Controls.Count > 0)