* 重构主题
This commit is contained in:
parent
42ade126ad
commit
5d55924dba
@ -329,7 +329,7 @@ namespace Sunny.UI
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
public void SetStyle(UIStyle style)
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -337,7 +337,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -353,7 +359,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -236,7 +236,7 @@ namespace Sunny.UI
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
public void SetStyle(UIStyle style)
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -244,7 +244,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -260,7 +266,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -315,7 +315,7 @@ namespace Sunny.UI
|
||||
if (unSelectedForeColor != value)
|
||||
{
|
||||
unSelectedForeColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,15 +62,6 @@ namespace Sunny.UI
|
||||
public UICheckBoxGroup()
|
||||
{
|
||||
items.CountChange += Items_CountChange;
|
||||
StyleCustomModeChanged += UICheckBoxGroup_StyleCustomModeChanged;
|
||||
}
|
||||
|
||||
private void UICheckBoxGroup_StyleCustomModeChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var item in boxes)
|
||||
{
|
||||
item.StyleCustomMode = styleCustomMode;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
|
@ -83,7 +83,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -94,7 +94,11 @@ namespace Sunny.UI
|
||||
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
|
||||
public string TagString { get; set; }
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -102,7 +106,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -281,16 +281,11 @@ namespace Sunny.UI
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
protected void SetStyleCustom(bool needRefresh = true)
|
||||
{
|
||||
if (needRefresh) Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
public void SetStyle(UIStyle style)
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -307,26 +302,12 @@ namespace Sunny.UI
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
protected bool styleCustomMode = false;
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get => styleCustomMode;
|
||||
set
|
||||
{
|
||||
if (styleCustomMode != value)
|
||||
{
|
||||
styleCustomMode = value;
|
||||
StyleCustomModeChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler StyleCustomModeChanged;
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置主题样式颜色
|
||||
@ -757,7 +738,7 @@ namespace Sunny.UI
|
||||
if (fillSelectedColor != color)
|
||||
{
|
||||
fillSelectedColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,7 +751,7 @@ namespace Sunny.UI
|
||||
if (foreSelectedColor != color)
|
||||
{
|
||||
foreSelectedColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,7 +764,7 @@ namespace Sunny.UI
|
||||
if (rectSelectedColor != color)
|
||||
{
|
||||
rectSelectedColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -796,7 +777,7 @@ namespace Sunny.UI
|
||||
if (fillHoverColor != color)
|
||||
{
|
||||
fillHoverColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -809,7 +790,7 @@ namespace Sunny.UI
|
||||
if (fillPressColor != color)
|
||||
{
|
||||
fillPressColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -822,7 +803,7 @@ namespace Sunny.UI
|
||||
if (fillDisableColor != color)
|
||||
{
|
||||
fillDisableColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -835,7 +816,7 @@ namespace Sunny.UI
|
||||
if (fillReadOnlyColor != color)
|
||||
{
|
||||
fillReadOnlyColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,7 +829,7 @@ namespace Sunny.UI
|
||||
if (rectHoverColor != color)
|
||||
{
|
||||
rectHoverColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -861,7 +842,7 @@ namespace Sunny.UI
|
||||
if (rectPressColor != color)
|
||||
{
|
||||
rectPressColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,7 +855,7 @@ namespace Sunny.UI
|
||||
if (rectDisableColor != color)
|
||||
{
|
||||
rectDisableColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -887,7 +868,7 @@ namespace Sunny.UI
|
||||
if (rectReadOnlyColor != color)
|
||||
{
|
||||
rectReadOnlyColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,7 +881,7 @@ namespace Sunny.UI
|
||||
if (foreHoverColor != color)
|
||||
{
|
||||
foreHoverColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -913,7 +894,7 @@ namespace Sunny.UI
|
||||
if (forePressColor != color)
|
||||
{
|
||||
forePressColor = color;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -926,7 +907,7 @@ namespace Sunny.UI
|
||||
if (foreDisableColor != color)
|
||||
{
|
||||
foreDisableColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -939,7 +920,7 @@ namespace Sunny.UI
|
||||
if (foreReadOnlyColor != color)
|
||||
{
|
||||
foreReadOnlyColor = color;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -952,7 +933,7 @@ namespace Sunny.UI
|
||||
if (rectColor != value)
|
||||
{
|
||||
rectColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -965,7 +946,7 @@ namespace Sunny.UI
|
||||
if (fillColor != value)
|
||||
{
|
||||
fillColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -978,7 +959,7 @@ namespace Sunny.UI
|
||||
if (fillColor2 != value)
|
||||
{
|
||||
fillColor2 = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -991,7 +972,7 @@ namespace Sunny.UI
|
||||
if (foreColor != value)
|
||||
{
|
||||
foreColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -657,7 +661,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
@ -720,7 +730,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -54,43 +54,23 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
[Description("填充颜色,当值为背景色或透明色或空值则不填充"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "243, 249, 255")]
|
||||
[Description("填充颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color FillColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return fillColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (fillColor != value)
|
||||
{
|
||||
fillColor = value;
|
||||
SetStyleCustom();
|
||||
}
|
||||
}
|
||||
get => fillColor;
|
||||
set => SetFillColor(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("边框颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "243, 249, 255")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color RectColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return rectColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (rectColor != value)
|
||||
{
|
||||
rectColor = value;
|
||||
SetStyleCustom();
|
||||
}
|
||||
}
|
||||
get => rectColor;
|
||||
set => SetRectColor(value);
|
||||
}
|
||||
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -105,7 +105,11 @@ namespace Sunny.UI
|
||||
foreColor = uiColor.ImageButtonForeColor;
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -113,7 +117,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
private UIStyle _style = UIStyle.Blue;
|
||||
@ -213,7 +223,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -570,7 +570,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -654,7 +654,11 @@ namespace Sunny.UI
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -662,7 +666,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -1342,12 +1342,9 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
protected UIStyle _style = UIStyle.Blue;
|
||||
|
||||
@ -1361,19 +1358,25 @@ namespace Sunny.UI
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
SetStyleColor(style.Colors());
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
this.ResumeLayout();
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public virtual void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -119,7 +119,11 @@ namespace Sunny.UI
|
||||
|
||||
public string Version { get; }
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -127,13 +131,19 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -231,11 +241,15 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -243,7 +257,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -170,7 +170,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -233,7 +233,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -241,7 +245,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -743,7 +743,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -751,7 +755,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
@ -763,7 +773,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -305,7 +305,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -459,7 +459,11 @@ namespace Sunny.UI
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -467,7 +471,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -45,7 +45,6 @@ namespace Sunny.UI
|
||||
public UIRadioButtonGroup()
|
||||
{
|
||||
items.CountChange += Items_CountChange;
|
||||
StyleCustomModeChanged += UICheckBoxGroup_StyleCustomModeChanged;
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
@ -61,14 +60,6 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void UICheckBoxGroup_StyleCustomModeChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var item in buttons)
|
||||
{
|
||||
item.StyleCustomMode = styleCustomMode;
|
||||
}
|
||||
}
|
||||
|
||||
private void Items_CountChange(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
|
@ -216,7 +216,7 @@ namespace Sunny.UI
|
||||
set
|
||||
{
|
||||
foreColor2 = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,11 @@ namespace Sunny.UI
|
||||
|
||||
public string Version { get; }
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -137,13 +141,19 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
|
@ -266,7 +266,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -641,7 +641,7 @@ namespace Sunny.UI
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
public void SetStyle(UIStyle style)
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -649,7 +649,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetDPIScale()
|
||||
|
@ -106,7 +106,7 @@ namespace Sunny.UI
|
||||
if (symbolColor != value)
|
||||
{
|
||||
symbolColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,7 @@ namespace Sunny.UI
|
||||
if (symbolHoverColor != value)
|
||||
{
|
||||
symbolHoverColor = value;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace Sunny.UI
|
||||
if (symbolPressColor != value)
|
||||
{
|
||||
symbolPressColor = value;
|
||||
SetStyleCustom(false);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace Sunny.UI
|
||||
if (symbolDisableColor != value)
|
||||
{
|
||||
symbolDisableColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ namespace Sunny.UI
|
||||
if (symbolSelectedColor != value)
|
||||
{
|
||||
symbolSelectedColor = value;
|
||||
SetStyleCustom();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,12 +300,9 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
private HorizontalAlignment textAlignment = HorizontalAlignment.Center;
|
||||
|
||||
@ -528,7 +525,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -536,7 +537,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -97,7 +97,7 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
@ -277,7 +277,11 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -285,7 +289,13 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -57,12 +57,9 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
private UIStyle _style = UIStyle.Blue;
|
||||
|
||||
@ -86,12 +83,25 @@ namespace Sunny.UI
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
_style = style;
|
||||
this.ResumeLayout();
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
SetStyleColor(style.Colors());
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -1318,7 +1318,7 @@ namespace Sunny.UI
|
||||
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor, new Rectangle(4 + symbolOffset.X, (Height - SymbolSize) / 2 + 1 + symbolOffset.Y, SymbolSize, SymbolSize), SymbolOffset.X, SymbolOffset.Y, SymbolRotate);
|
||||
}
|
||||
|
||||
if (styleCustomMode && Text.IsValid() && NeedDrawDisabledText)
|
||||
if (Text.IsValid() && NeedDrawDisabledText)
|
||||
{
|
||||
string text = Text;
|
||||
if (PasswordChar > 0)
|
||||
|
@ -598,26 +598,13 @@ namespace Sunny.UI
|
||||
{
|
||||
}
|
||||
|
||||
protected bool styleCustomMode = false;
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get => styleCustomMode;
|
||||
set
|
||||
{
|
||||
if (styleCustomMode != value)
|
||||
{
|
||||
styleCustomMode = value;
|
||||
StyleCustomModeChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
public event EventHandler StyleCustomModeChanged;
|
||||
|
||||
protected UIStyle _style = UIStyle.Blue;
|
||||
|
||||
@ -631,19 +618,25 @@ namespace Sunny.UI
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="style">主题样式</param>
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
SetStyleColor(style.Colors());
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
this.ResumeLayout();
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
}
|
||||
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
SetStyle(style);
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
public virtual void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
@ -310,6 +310,7 @@ namespace Sunny.UI
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
base.OnControlAdded(e);
|
||||
|
||||
if (ShowTitle && !AllowAddControlOnTitle && e.Control.Top < TitleHeight)
|
||||
{
|
||||
e.Control.Top = Padding.Top;
|
||||
@ -1240,7 +1241,7 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
|
||||
@ -1255,12 +1256,12 @@ namespace Sunny.UI
|
||||
this.ResumeLayout();
|
||||
}
|
||||
|
||||
[Description("自定义主题模式(开启后全局主题更改将对当前窗体无效)"), Category("SunnyUI")]
|
||||
[DefaultValue(false)]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
private Color controlBoxForeColor = Color.White;
|
||||
/// <summary>
|
||||
|
@ -465,12 +465,9 @@ namespace Sunny.UI
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
public event EventHandler Initialize;
|
||||
|
||||
@ -479,12 +476,6 @@ namespace Sunny.UI
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
base.OnControlAdded(e);
|
||||
if (e.Control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
UIStyleHelper.SetRawControlStyle(e, Style);
|
||||
|
||||
if (AllowShowTitle && !AllowAddControlOnTitle && e.Control.Top < TitleHeight)
|
||||
{
|
||||
@ -562,10 +553,28 @@ namespace Sunny.UI
|
||||
Finalize?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
public void SetInheritedStyle(UIStyle style)
|
||||
{
|
||||
if (!DesignMode)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
if (_style == UIStyle.Inherited && style.IsValid())
|
||||
{
|
||||
SetStyleColor(style.Colors());
|
||||
Invalidate();
|
||||
_style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
UIStyleChanged?.Invoke(this, new EventArgs());
|
||||
this.ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
if (!style.IsCustom())
|
||||
{
|
||||
@ -573,7 +582,7 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
_style = style;
|
||||
_style = style == UIStyle.Inherited ? UIStyle.Inherited : UIStyle.Custom;
|
||||
UIStyleChanged?.Invoke(this, new EventArgs());
|
||||
this.ResumeLayout();
|
||||
}
|
||||
|
@ -43,7 +43,8 @@ namespace Sunny.UI
|
||||
|
||||
void SetStyleColor(UIBaseStyle uiColor);
|
||||
|
||||
void SetStyle(UIStyle style);
|
||||
//void SetStyle(UIStyle style);
|
||||
void SetInheritedStyle(UIStyle style);
|
||||
|
||||
void SetDPIScale();
|
||||
}
|
||||
@ -400,20 +401,9 @@ namespace Sunny.UI
|
||||
List<Control> controls = ctrl.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
if (control is IStyleInterface item && item.Style == UIStyle.Inherited)
|
||||
{
|
||||
if (item.Style == UIStyle.Inherited)
|
||||
{
|
||||
if (item is UIButton ctrl1)
|
||||
{
|
||||
ctrl1.SetInheritedStyle(style);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Style = style;
|
||||
item.Style = UIStyle.Inherited;
|
||||
}
|
||||
}
|
||||
item.SetInheritedStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
@ -425,7 +415,7 @@ namespace Sunny.UI
|
||||
UIContextMenuStrip context = (UIContextMenuStrip)info.GetValue(ctrl);
|
||||
if (context != null && context.Style == UIStyle.Inherited)
|
||||
{
|
||||
context.SetStyle(style);
|
||||
context.SetInheritedStyle(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,17 @@ namespace Sunny.UI
|
||||
Version = UIGlobal.Version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主题样式
|
||||
/// </summary>
|
||||
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
|
||||
[Browsable(false)]
|
||||
public UIStyle Style
|
||||
{
|
||||
get => UIStyles.Style;
|
||||
set => UIStyles.SetStyle(value);
|
||||
}
|
||||
|
||||
[DefaultValue(false), Description("DPI缩放"), Category("SunnyUI")]
|
||||
public bool DPIScale
|
||||
{
|
||||
|
@ -394,7 +394,9 @@ namespace Sunny.UI
|
||||
/// <param name="style">主题样式</param>
|
||||
public static void SetStyle(UIStyle style)
|
||||
{
|
||||
if (Style == style) return;
|
||||
Style = style;
|
||||
if (!style.IsValid()) return;
|
||||
|
||||
foreach (var form in Forms.Values)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user