* UIRadioButton: 增加修改图标大小

* UICheckBox: 增加修改图标大小
This commit is contained in:
Sunny 2023-11-07 22:01:53 +08:00
parent 878c93f509
commit 718560e5c4
25 changed files with 74 additions and 81 deletions

View File

@ -313,12 +313,12 @@ namespace Sunny.UI
SelectedHSLColor = new HSLColor(angle, saturation, SelectedHSLColor.Lightness); SelectedHSLColor = new HSLColor(angle, saturation, SelectedHSLColor.Lightness);
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// Ö÷ÌâÑùʽ /// Ö÷ÌâÑùʽ
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -220,12 +220,12 @@ namespace Sunny.UI
} }
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// Ö÷ÌâÑùʽ /// Ö÷ÌâÑùʽ
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -22,6 +22,7 @@
* 2021-04-26: V3.0.3 CheckedChanged * 2021-04-26: V3.0.3 CheckedChanged
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2023-05-12: V3.3.6 DrawString函数 * 2023-05-12: V3.3.6 DrawString函数
* 2023-11-07: V3.5.2
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -104,11 +105,21 @@ namespace Sunny.UI
private int _imageSize = 16; private int _imageSize = 16;
private int _imageInterval = 3; private int _imageInterval = 3;
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
[Browsable(false)]
public int CheckBoxSize
{
get => ImageSize;
set => ImageSize = value;
}
/// <summary> /// <summary>
/// 图标大小 /// 图标大小
/// </summary> /// </summary>
[DefaultValue(16)] [DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")] [Description("图标大小"), Category("SunnyUI")]
[Browsable(false)]
public int ImageSize public int ImageSize
{ {
get => _imageSize; get => _imageSize;

View File

@ -124,12 +124,12 @@ namespace Sunny.UI
public string Version { get; } public string Version { get; }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -613,12 +613,12 @@ namespace Sunny.UI
SetScrollInfo(); SetScrollInfo();
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;
@ -957,7 +957,6 @@ namespace Sunny.UI
scrollBarColor = value; scrollBarColor = value;
HBar.HoverColor = HBar.PressColor = HBar.ForeColor = value; HBar.HoverColor = HBar.PressColor = HBar.ForeColor = value;
VBar.HoverColor = VBar.PressColor = VBar.ForeColor = value; VBar.HoverColor = VBar.PressColor = VBar.ForeColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }
} }
@ -971,7 +970,6 @@ namespace Sunny.UI
{ {
scrollBarRectColor = value; scrollBarRectColor = value;
VBar.RectColor = value; VBar.RectColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }
} }
@ -991,7 +989,6 @@ namespace Sunny.UI
scrollBarBackColor = value; scrollBarBackColor = value;
HBar.FillColor = value; HBar.FillColor = value;
VBar.FillColor = value; VBar.FillColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }
} }

View File

@ -372,7 +372,6 @@ namespace Sunny.UI
scrollBarColor = value; scrollBarColor = value;
HBar.HoverColor = HBar.PressColor = HBar.ForeColor = value; HBar.HoverColor = HBar.PressColor = HBar.ForeColor = value;
VBar.HoverColor = VBar.PressColor = VBar.ForeColor = value; VBar.HoverColor = VBar.PressColor = VBar.ForeColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }
} }
@ -392,7 +391,6 @@ namespace Sunny.UI
scrollBarBackColor = value; scrollBarBackColor = value;
HBar.FillColor = value; HBar.FillColor = value;
VBar.FillColor = value; VBar.FillColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }
} }

View File

@ -162,7 +162,6 @@ namespace Sunny.UI
if (fillColor != value) if (fillColor != value)
{ {
fillColor = value; fillColor = value;
_style = UIStyle.Custom;
Invalidate(); Invalidate();
} }

View File

@ -86,7 +86,7 @@ namespace Sunny.UI
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;
@ -126,7 +126,7 @@ namespace Sunny.UI
_style = UIStyle.Inherited; _style = UIStyle.Inherited;
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
private float DefaultFontSize = -1; private float DefaultFontSize = -1;
public void SetDPIScale() public void SetDPIScale()

View File

@ -461,7 +461,6 @@ namespace Sunny.UI
{ {
hoverColor = value; hoverColor = value;
listbox.HoverColor = hoverColor; listbox.HoverColor = hoverColor;
_style = UIStyle.Custom;
} }
} }
@ -576,7 +575,7 @@ namespace Sunny.UI
public string Version { get; } public string Version { get; }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
private Color _itemSelectBackColor = UIColor.Blue; private Color _itemSelectBackColor = UIColor.Blue;
private Color _itemSelectForeColor = Color.White; private Color _itemSelectForeColor = Color.White;
private int imageInterval = 4; private int imageInterval = 4;
@ -647,7 +646,7 @@ namespace Sunny.UI
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;
@ -690,9 +689,7 @@ namespace Sunny.UI
if (_itemSelectBackColor != value) if (_itemSelectBackColor != value)
{ {
_itemSelectBackColor = value; _itemSelectBackColor = value;
_style = UIStyle.Custom; Invalidate();
if (DesignMode)
Invalidate();
} }
} }
} }
@ -706,9 +703,7 @@ namespace Sunny.UI
if (_itemSelectForeColor != value) if (_itemSelectForeColor != value)
{ {
_itemSelectForeColor = value; _itemSelectForeColor = value;
_style = UIStyle.Custom; Invalidate();
if (DesignMode)
Invalidate();
} }
} }
} }
@ -828,7 +823,7 @@ namespace Sunny.UI
set set
{ {
hoverColor = value; hoverColor = value;
_style = UIStyle.Custom; Invalidate();
} }
} }

View File

@ -1346,12 +1346,12 @@ namespace Sunny.UI
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")] [Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
public bool StyleCustomMode { get; set; } public bool StyleCustomMode { get; set; }
protected UIStyle _style = UIStyle.Blue; protected UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -152,12 +152,12 @@ namespace Sunny.UI
ForeColor = uiColor.LabelForeColor; ForeColor = uiColor.LabelForeColor;
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;
@ -273,12 +273,12 @@ namespace Sunny.UI
base.LinkColor = linkColor; base.LinkColor = linkColor;
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -197,14 +197,14 @@ namespace Sunny.UI
#endregion #endregion
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
private Color _itemSelectBackColor = UIColor.Blue; private Color _itemSelectBackColor = UIColor.Blue;
private Color _itemSelectForeColor = Color.White; private Color _itemSelectForeColor = Color.White;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -309,12 +309,12 @@ namespace Sunny.UI
} }
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -447,12 +447,12 @@ namespace Sunny.UI
} }
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -57,7 +57,7 @@ namespace Sunny.UI
{ {
foreColor = value; foreColor = value;
AfterSetForeColor(value); AfterSetForeColor(value);
SetStyleCustom(); Invalidate();
} }
} }
@ -93,7 +93,7 @@ namespace Sunny.UI
{ {
foreReadOnlyColor = color; foreReadOnlyColor = color;
AfterSetForeReadOnlyColor(color); AfterSetForeReadOnlyColor(color);
SetStyleCustom(); Invalidate();
} }
} }
} }

View File

@ -23,6 +23,7 @@
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2022-12-21: V3.3.0 CheckedChanged事件 * 2022-12-21: V3.3.0 CheckedChanged事件
* 2023-05-12: V3.3.6 DrawString函数 * 2023-05-12: V3.3.6 DrawString函数
* 2023-11-07: V3.5.2
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -105,8 +106,18 @@ namespace Sunny.UI
private int _imageSize = 16; private int _imageSize = 16;
private int _imageInterval = 3; private int _imageInterval = 3;
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
[Browsable(false)]
public int RadioButtonSize
{
get => ImageSize;
set => ImageSize = value;
}
[DefaultValue(16)] [DefaultValue(16)]
[Description("按钮图片大小"), Category("SunnyUI")] [Description("按钮图片大小"), Category("SunnyUI")]
[Browsable(false)]
public int ImageSize public int ImageSize
{ {
get => _imageSize; get => _imageSize;

View File

@ -167,12 +167,12 @@ namespace Sunny.UI
drawPen.Color = rectColor; drawPen.Color = rectColor;
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -251,12 +251,12 @@ namespace Sunny.UI
} }
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -248,12 +248,12 @@ namespace Sunny.UI
} }
} }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -61,12 +61,12 @@ namespace Sunny.UI
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")] [Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
public bool StyleCustomMode { get; set; } public bool StyleCustomMode { get; set; }
private UIStyle _style = UIStyle.Blue; private UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;

View File

@ -435,18 +435,6 @@ namespace Sunny.UI
private bool NeedDrawDisabledText => !Enabled && StyleCustomMode && (ForeDisableColor != Color.FromArgb(109, 109, 103) || FillDisableColor != Color.FromArgb(244, 244, 244)); private bool NeedDrawDisabledText => !Enabled && StyleCustomMode && (ForeDisableColor != Color.FromArgb(109, 109, 103) || FillDisableColor != Color.FromArgb(244, 244, 244));
protected override void SetStyleCustom(bool needRefresh = true)
{
base.SetStyleCustom(needRefresh);
edit.Visible = true;
edit.Enabled = Enabled;
if (!Enabled)
{
if (NeedDrawDisabledText) edit.Visible = false;
}
Invalidate();
}
public override bool Focused => edit.Focused; public override bool Focused => edit.Focused;
[DefaultValue(false)] [DefaultValue(false)]

View File

@ -194,7 +194,7 @@ namespace Sunny.UI
if (symbolColor != value) if (symbolColor != value)
{ {
symbolColor = value; symbolColor = value;
SetStyleCustom(); Invalidate();
} }
} }
} }

View File

@ -336,7 +336,7 @@ namespace Sunny.UI
set set
{ {
view.HoverColor = hoverColor = value; view.HoverColor = hoverColor = value;
SetStyleCustom(); Invalidate();
} }
} }
@ -348,7 +348,7 @@ namespace Sunny.UI
set set
{ {
view.SelectedColor = selectedColor = value; view.SelectedColor = selectedColor = value;
SetStyleCustom(); Invalidate();
} }
} }
@ -360,7 +360,7 @@ namespace Sunny.UI
set set
{ {
view.SelectedForeColor = selectedForeColor = value; view.SelectedForeColor = selectedForeColor = value;
SetStyleCustom(); Invalidate();
} }
} }

View File

@ -266,7 +266,7 @@ namespace Sunny.UI
{ {
rectColor = value; rectColor = value;
RectColorChanged?.Invoke(this, null); RectColorChanged?.Invoke(this, null);
SetStyleCustom(); Invalidate();
} }
AfterSetRectColor(value); AfterSetRectColor(value);
@ -290,7 +290,7 @@ namespace Sunny.UI
{ {
fillColor = value; fillColor = value;
FillColorChanged?.Invoke(this, null); FillColorChanged?.Invoke(this, null);
SetStyleCustom(); Invalidate();
} }
AfterSetFillColor(value); AfterSetFillColor(value);
@ -323,7 +323,7 @@ namespace Sunny.UI
if (fillColor2 != value) if (fillColor2 != value)
{ {
fillColor2 = value; fillColor2 = value;
SetStyleCustom(); Invalidate();
} }
} }
@ -341,19 +341,19 @@ namespace Sunny.UI
protected virtual void SetFillDisableColor(Color color) protected virtual void SetFillDisableColor(Color color)
{ {
fillDisableColor = color; fillDisableColor = color;
SetStyleCustom(); Invalidate();
} }
protected virtual void SetRectDisableColor(Color color) protected virtual void SetRectDisableColor(Color color)
{ {
rectDisableColor = color; rectDisableColor = color;
SetStyleCustom(); Invalidate();
} }
protected virtual void SetForeDisableColor(Color color) protected virtual void SetForeDisableColor(Color color)
{ {
foreDisableColor = color; foreDisableColor = color;
SetStyleCustom(); Invalidate();
} }
protected bool showText = false; protected bool showText = false;
@ -606,12 +606,12 @@ namespace Sunny.UI
public bool StyleCustomMode { get; set; } public bool StyleCustomMode { get; set; }
protected UIStyle _style = UIStyle.Blue; protected UIStyle _style = UIStyle.Inherited;
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style public UIStyle Style
{ {
get => _style; get => _style;
@ -663,7 +663,7 @@ namespace Sunny.UI
{ {
fillReadOnlyColor = color; fillReadOnlyColor = color;
AfterSetFillReadOnlyColor(color); AfterSetFillReadOnlyColor(color);
SetStyleCustom(); Invalidate();
} }
/// <summary> /// <summary>
@ -674,7 +674,7 @@ namespace Sunny.UI
{ {
rectReadOnlyColor = color; rectReadOnlyColor = color;
AfterSetRectReadOnlyColor(color); AfterSetRectReadOnlyColor(color);
SetStyleCustom(); Invalidate();
} }
[DefaultValue(typeof(Color), "244, 244, 244")] [DefaultValue(typeof(Color), "244, 244, 244")]
@ -794,11 +794,5 @@ namespace Sunny.UI
[Browsable(false)] [Browsable(false)]
public new bool AutoScroll { get; set; } = false; public new bool AutoScroll { get; set; } = false;
protected virtual void SetStyleCustom(bool needRefresh = true)
{
_style = UIStyle.Custom;
if (needRefresh) Invalidate();
}
} }
} }

View File

@ -52,7 +52,7 @@ namespace Sunny.UI
/// <summary> /// <summary>
/// 主题样式 /// 主题样式
/// </summary> /// </summary>
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")] [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
[Browsable(false)] [Browsable(false)]
public UIStyle Style public UIStyle Style
{ {