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