diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 56dedf70..15d9a970 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UISplitContainer.cs b/SunnyUI/Controls/UISplitContainer.cs index e411309e..378b839f 100644 --- a/SunnyUI/Controls/UISplitContainer.cs +++ b/SunnyUI/Controls/UISplitContainer.cs @@ -17,6 +17,7 @@ * 创建日期: 2021-10-30 * * 2021-10-30: V3.0.8 增加文件说明 + * 2022-04-03: V3.1.3 增加主题样式 ******************************************************************************/ using System; using System.ComponentModel; @@ -25,7 +26,7 @@ using System.Windows.Forms; namespace Sunny.UI { - public class UISplitContainer : SplitContainer + public class UISplitContainer : SplitContainer, IStyleInterface { private enum UIMouseType { @@ -75,6 +76,13 @@ namespace Sunny.UI _lastDistance = SplitterDistance; SplitterWidth = 10; MinimumSize = new Size(20, 20); + Version = UIGlobal.Version; + } + + protected void SetStyleCustom(bool needRefresh = true) + { + _style = UIStyle.Custom; + if (needRefresh) Invalidate(); } private Color barColor = Color.FromArgb(56, 56, 56); @@ -129,7 +137,7 @@ namespace Sunny.UI set { arrowColor = value; - Invalidate(); + SetStyleCustom(); } } @@ -219,6 +227,46 @@ namespace Sunny.UI } } + protected UIStyle _style = UIStyle.Blue; + + /// + /// 主题样式 + /// + [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] + public UIStyle Style + { + get => _style; + set => SetStyle(value); + } + + /// + /// 自定义主题风格 + /// + [DefaultValue(false)] + [Description("获取或设置可以自定义主题风格"), Category("SunnyUI")] + public bool StyleCustomMode { get; set; } + + /// + /// 版本 + /// + public string Version + { + get; + } + + /// + /// Tag字符串 + /// + [DefaultValue(null)] + [Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")] + public string TagString + { + get; set; + } + + [Browsable(false), DefaultValue(false)] + public bool IsScaled { get; set; } + public void Collapse() { if (_collapsePanel != UICollapsePanel.None && SplitPanelState == UISplitPanelState.Expanded) @@ -536,5 +584,30 @@ namespace Sunny.UI DefaultArrowWidth); } } + + public void SetStyleColor(UIBaseStyle uiColor) + { + arrowColor = uiColor.SplitContainerArrowColor; + } + + /// + /// 设置主题样式 + /// + /// 主题样式 + public void SetStyle(UIStyle style) + { + if (!style.IsCustom()) + { + SetStyleColor(style.Colors()); + Invalidate(); + } + + _style = style; + } + + public void SetDPIScale() + { + // + } } } diff --git a/SunnyUI/Style/UIStyleColor.cs b/SunnyUI/Style/UIStyleColor.cs index 867700c5..1155a672 100644 --- a/SunnyUI/Style/UIStyleColor.cs +++ b/SunnyUI/Style/UIStyleColor.cs @@ -224,6 +224,9 @@ namespace Sunny.UI public virtual Color FlowLayoutPanelBarFillColor { get; protected set; } public virtual Color FlowLayoutPanelBarForeColor { get; protected set; } + //SplitContainer + public virtual Color SplitContainerArrowColor { get; protected set; } + protected Color ForeColor { get; set; } public UIBaseStyle DropDownStyle { get; protected set; } @@ -246,6 +249,8 @@ namespace Sunny.UI SecondaryColor = colors[5]; RegularColor = colors[10]; + SplitContainerArrowColor = PrimaryColor; + GridSelectedColor = colors[3]; GridSelectedForeColor = foreColor; GridStripeEvenColor = colors[0]; @@ -589,6 +594,8 @@ namespace Sunny.UI DropDownPanelForeColor = UIFontColor.Primary; DropDownStyle = UIStyles.Blue; + + SplitContainerArrowColor = UIColor.Blue; } } @@ -704,6 +711,8 @@ namespace Sunny.UI DropDownPanelForeColor = UIFontColor.Primary; DropDownStyle = UIStyles.Blue; + + SplitContainerArrowColor = UIColor.Blue; } } } \ No newline at end of file