* 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);
}
private UIStyle _style = UIStyle.Blue;
private UIStyle _style = UIStyle.Inherited;
/// <summary>
/// Ö÷ÌâÑùʽ
/// </summary>
[DefaultValue(UIStyle.Blue), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")]
[DefaultValue(UIStyle.Inherited), Description("Ö÷ÌâÑùʽ"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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