* 重构主题

This commit is contained in:
Sunny 2023-11-12 22:05:11 +08:00
parent 8ce0156d97
commit ef52687e98
6 changed files with 18 additions and 13 deletions

View File

@ -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);
//}
/// <summary>
/// 设置主题样式
/// </summary>

View File

@ -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)]

View File

@ -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;

View File

@ -1380,6 +1380,9 @@ namespace Sunny.UI
if (!DesignMode && UIStyles.Style.IsValid())
{
Style = UIStyles.Style;
this.SuspendLayout();
UIStyleHelper.SetChildUIStyle(this, UIStyles.Style);
this.ResumeLayout();
}
}

View File

@ -293,6 +293,9 @@ namespace Sunny.UI
if (!DesignMode && UIStyles.Style.IsValid())
{
Style = UIStyles.Style;
this.SuspendLayout();
UIStyleHelper.SetChildUIStyle(this, UIStyles.Style);
this.ResumeLayout();
}
}

View File

@ -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)