* UISplitContainer: 增加主题样式
This commit is contained in:
parent
93e10483d3
commit
d11e4d4a5e
Binary file not shown.
@ -17,6 +17,7 @@
|
|||||||
* 创建日期: 2021-10-30
|
* 创建日期: 2021-10-30
|
||||||
*
|
*
|
||||||
* 2021-10-30: V3.0.8 增加文件说明
|
* 2021-10-30: V3.0.8 增加文件说明
|
||||||
|
* 2022-04-03: V3.1.3 增加主题样式
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -25,7 +26,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public class UISplitContainer : SplitContainer
|
public class UISplitContainer : SplitContainer, IStyleInterface
|
||||||
{
|
{
|
||||||
private enum UIMouseType
|
private enum UIMouseType
|
||||||
{
|
{
|
||||||
@ -75,6 +76,13 @@ namespace Sunny.UI
|
|||||||
_lastDistance = SplitterDistance;
|
_lastDistance = SplitterDistance;
|
||||||
SplitterWidth = 10;
|
SplitterWidth = 10;
|
||||||
MinimumSize = new Size(20, 20);
|
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);
|
private Color barColor = Color.FromArgb(56, 56, 56);
|
||||||
@ -129,7 +137,7 @@ namespace Sunny.UI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
arrowColor = value;
|
arrowColor = value;
|
||||||
Invalidate();
|
SetStyleCustom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,6 +227,46 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected UIStyle _style = UIStyle.Blue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主题样式
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
|
||||||
|
public UIStyle Style
|
||||||
|
{
|
||||||
|
get => _style;
|
||||||
|
set => SetStyle(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义主题风格
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(false)]
|
||||||
|
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||||
|
public bool StyleCustomMode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本
|
||||||
|
/// </summary>
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tag字符串
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(null)]
|
||||||
|
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
|
||||||
|
public string TagString
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false), DefaultValue(false)]
|
||||||
|
public bool IsScaled { get; set; }
|
||||||
|
|
||||||
public void Collapse()
|
public void Collapse()
|
||||||
{
|
{
|
||||||
if (_collapsePanel != UICollapsePanel.None && SplitPanelState == UISplitPanelState.Expanded)
|
if (_collapsePanel != UICollapsePanel.None && SplitPanelState == UISplitPanelState.Expanded)
|
||||||
@ -536,5 +584,30 @@ namespace Sunny.UI
|
|||||||
DefaultArrowWidth);
|
DefaultArrowWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetStyleColor(UIBaseStyle uiColor)
|
||||||
|
{
|
||||||
|
arrowColor = uiColor.SplitContainerArrowColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置主题样式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="style">主题样式</param>
|
||||||
|
public void SetStyle(UIStyle style)
|
||||||
|
{
|
||||||
|
if (!style.IsCustom())
|
||||||
|
{
|
||||||
|
SetStyleColor(style.Colors());
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
_style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDPIScale()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,9 @@ namespace Sunny.UI
|
|||||||
public virtual Color FlowLayoutPanelBarFillColor { get; protected set; }
|
public virtual Color FlowLayoutPanelBarFillColor { get; protected set; }
|
||||||
public virtual Color FlowLayoutPanelBarForeColor { get; protected set; }
|
public virtual Color FlowLayoutPanelBarForeColor { get; protected set; }
|
||||||
|
|
||||||
|
//SplitContainer
|
||||||
|
public virtual Color SplitContainerArrowColor { get; protected set; }
|
||||||
|
|
||||||
protected Color ForeColor { get; set; }
|
protected Color ForeColor { get; set; }
|
||||||
|
|
||||||
public UIBaseStyle DropDownStyle { get; protected set; }
|
public UIBaseStyle DropDownStyle { get; protected set; }
|
||||||
@ -246,6 +249,8 @@ namespace Sunny.UI
|
|||||||
SecondaryColor = colors[5];
|
SecondaryColor = colors[5];
|
||||||
RegularColor = colors[10];
|
RegularColor = colors[10];
|
||||||
|
|
||||||
|
SplitContainerArrowColor = PrimaryColor;
|
||||||
|
|
||||||
GridSelectedColor = colors[3];
|
GridSelectedColor = colors[3];
|
||||||
GridSelectedForeColor = foreColor;
|
GridSelectedForeColor = foreColor;
|
||||||
GridStripeEvenColor = colors[0];
|
GridStripeEvenColor = colors[0];
|
||||||
@ -589,6 +594,8 @@ namespace Sunny.UI
|
|||||||
DropDownPanelForeColor = UIFontColor.Primary;
|
DropDownPanelForeColor = UIFontColor.Primary;
|
||||||
|
|
||||||
DropDownStyle = UIStyles.Blue;
|
DropDownStyle = UIStyles.Blue;
|
||||||
|
|
||||||
|
SplitContainerArrowColor = UIColor.Blue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,6 +711,8 @@ namespace Sunny.UI
|
|||||||
DropDownPanelForeColor = UIFontColor.Primary;
|
DropDownPanelForeColor = UIFontColor.Primary;
|
||||||
|
|
||||||
DropDownStyle = UIStyles.Blue;
|
DropDownStyle = UIStyles.Blue;
|
||||||
|
|
||||||
|
SplitContainerArrowColor = UIColor.Blue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user