diff --git a/SunnyUI/Controls/Color/UIColorWheel.cs b/SunnyUI/Controls/Color/UIColorWheel.cs
index aa43589e..3f48ac85 100644
--- a/SunnyUI/Controls/Color/UIColorWheel.cs
+++ b/SunnyUI/Controls/Color/UIColorWheel.cs
@@ -313,12 +313,12 @@ namespace Sunny.UI
SelectedHSLColor = new HSLColor(angle, saturation, SelectedHSLColor.Lightness);
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// ʽ
///
- [DefaultValue(UIStyle.Blue), Description("ʽ"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("ʽ"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/Color/UILabelRotate.cs b/SunnyUI/Controls/Color/UILabelRotate.cs
index a2b47e02..61ef3e96 100644
--- a/SunnyUI/Controls/Color/UILabelRotate.cs
+++ b/SunnyUI/Controls/Color/UILabelRotate.cs
@@ -220,12 +220,12 @@ namespace Sunny.UI
}
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// ʽ
///
- [DefaultValue(UIStyle.Blue), Description("ʽ"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("ʽ"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UICheckBox.cs b/SunnyUI/Controls/UICheckBox.cs
index 8a45959e..4b999ba4 100644
--- a/SunnyUI/Controls/UICheckBox.cs
+++ b/SunnyUI/Controls/UICheckBox.cs
@@ -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;
+ }
+
///
/// 图标大小
///
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
+ [Browsable(false)]
public int ImageSize
{
get => _imageSize;
diff --git a/SunnyUI/Controls/UIContextMenuStrip.cs b/SunnyUI/Controls/UIContextMenuStrip.cs
index 5eb8ea31..defc2cec 100644
--- a/SunnyUI/Controls/UIContextMenuStrip.cs
+++ b/SunnyUI/Controls/UIContextMenuStrip.cs
@@ -124,12 +124,12 @@ namespace Sunny.UI
public string Version { get; }
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UIDataGridView.cs b/SunnyUI/Controls/UIDataGridView.cs
index 75a8a2fd..19a441ac 100644
--- a/SunnyUI/Controls/UIDataGridView.cs
+++ b/SunnyUI/Controls/UIDataGridView.cs
@@ -613,12 +613,12 @@ namespace Sunny.UI
SetScrollInfo();
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [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();
}
}
diff --git a/SunnyUI/Controls/UIFlowLayoutPanel.cs b/SunnyUI/Controls/UIFlowLayoutPanel.cs
index efcdf67d..0e7c9587 100644
--- a/SunnyUI/Controls/UIFlowLayoutPanel.cs
+++ b/SunnyUI/Controls/UIFlowLayoutPanel.cs
@@ -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();
}
}
diff --git a/SunnyUI/Controls/UIIPTextBox.cs b/SunnyUI/Controls/UIIPTextBox.cs
index 6aaee93f..e4f9cec9 100644
--- a/SunnyUI/Controls/UIIPTextBox.cs
+++ b/SunnyUI/Controls/UIIPTextBox.cs
@@ -162,7 +162,6 @@ namespace Sunny.UI
if (fillColor != value)
{
fillColor = value;
- _style = UIStyle.Custom;
Invalidate();
}
diff --git a/SunnyUI/Controls/UIImageButton.cs b/SunnyUI/Controls/UIImageButton.cs
index a43b623d..8f1cca41 100644
--- a/SunnyUI/Controls/UIImageButton.cs
+++ b/SunnyUI/Controls/UIImageButton.cs
@@ -86,7 +86,7 @@ namespace Sunny.UI
///
/// 主题样式
///
- [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()
diff --git a/SunnyUI/Controls/UIImageListBox.cs b/SunnyUI/Controls/UIImageListBox.cs
index 9496c02b..33731ffe 100644
--- a/SunnyUI/Controls/UIImageListBox.cs
+++ b/SunnyUI/Controls/UIImageListBox.cs
@@ -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
///
/// 主题样式
///
- [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();
}
}
diff --git a/SunnyUI/Controls/UIKnobControl.cs b/SunnyUI/Controls/UIKnobControl.cs
index b557b6da..5b0ac54c 100644
--- a/SunnyUI/Controls/UIKnobControl.cs
+++ b/SunnyUI/Controls/UIKnobControl.cs
@@ -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;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UILabel.cs b/SunnyUI/Controls/UILabel.cs
index 1949579c..3ffd8e0e 100644
--- a/SunnyUI/Controls/UILabel.cs
+++ b/SunnyUI/Controls/UILabel.cs
@@ -152,12 +152,12 @@ namespace Sunny.UI
ForeColor = uiColor.LabelForeColor;
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [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;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UIListBoxEx.cs b/SunnyUI/Controls/UIListBoxEx.cs
index 5a916c6d..b9054d67 100644
--- a/SunnyUI/Controls/UIListBoxEx.cs
+++ b/SunnyUI/Controls/UIListBoxEx.cs
@@ -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;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs
index f311463c..1b16fda2 100644
--- a/SunnyUI/Controls/UINavBar.cs
+++ b/SunnyUI/Controls/UINavBar.cs
@@ -309,12 +309,12 @@ namespace Sunny.UI
}
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UINavMenu.cs b/SunnyUI/Controls/UINavMenu.cs
index eed3348c..8a5570fe 100644
--- a/SunnyUI/Controls/UINavMenu.cs
+++ b/SunnyUI/Controls/UINavMenu.cs
@@ -447,12 +447,12 @@ namespace Sunny.UI
}
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UIPanel.cs b/SunnyUI/Controls/UIPanel.cs
index 64820ef9..cf3a9f68 100644
--- a/SunnyUI/Controls/UIPanel.cs
+++ b/SunnyUI/Controls/UIPanel.cs
@@ -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();
}
}
}
\ No newline at end of file
diff --git a/SunnyUI/Controls/UIRadioButton.cs b/SunnyUI/Controls/UIRadioButton.cs
index 37d8ac24..e588f27f 100644
--- a/SunnyUI/Controls/UIRadioButton.cs
+++ b/SunnyUI/Controls/UIRadioButton.cs
@@ -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;
diff --git a/SunnyUI/Controls/UISmoothLabel.cs b/SunnyUI/Controls/UISmoothLabel.cs
index 0cc88be7..c9893045 100644
--- a/SunnyUI/Controls/UISmoothLabel.cs
+++ b/SunnyUI/Controls/UISmoothLabel.cs
@@ -167,12 +167,12 @@ namespace Sunny.UI
drawPen.Color = rectColor;
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UISplitContainer.cs b/SunnyUI/Controls/UISplitContainer.cs
index b1586dfd..1fe22967 100644
--- a/SunnyUI/Controls/UISplitContainer.cs
+++ b/SunnyUI/Controls/UISplitContainer.cs
@@ -251,12 +251,12 @@ namespace Sunny.UI
}
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UITabControlMenu.cs b/SunnyUI/Controls/UITabControlMenu.cs
index 3fb1eea7..b9da8228 100644
--- a/SunnyUI/Controls/UITabControlMenu.cs
+++ b/SunnyUI/Controls/UITabControlMenu.cs
@@ -248,12 +248,12 @@ namespace Sunny.UI
}
}
- private UIStyle _style = UIStyle.Blue;
+ private UIStyle _style = UIStyle.Inherited;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UITableLayoutPanel.cs b/SunnyUI/Controls/UITableLayoutPanel.cs
index da36c85d..a3a640c4 100644
--- a/SunnyUI/Controls/UITableLayoutPanel.cs
+++ b/SunnyUI/Controls/UITableLayoutPanel.cs
@@ -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;
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
public UIStyle Style
{
get => _style;
diff --git a/SunnyUI/Controls/UITextBox.cs b/SunnyUI/Controls/UITextBox.cs
index 33aa14e6..5fee6ba7 100644
--- a/SunnyUI/Controls/UITextBox.cs
+++ b/SunnyUI/Controls/UITextBox.cs
@@ -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)]
diff --git a/SunnyUI/Controls/UITitlePanel.cs b/SunnyUI/Controls/UITitlePanel.cs
index 034aafcf..fcbcf03c 100644
--- a/SunnyUI/Controls/UITitlePanel.cs
+++ b/SunnyUI/Controls/UITitlePanel.cs
@@ -194,7 +194,7 @@ namespace Sunny.UI
if (symbolColor != value)
{
symbolColor = value;
- SetStyleCustom();
+ Invalidate();
}
}
}
diff --git a/SunnyUI/Controls/UITreeView.cs b/SunnyUI/Controls/UITreeView.cs
index 7c18f693..85fbc9e6 100644
--- a/SunnyUI/Controls/UITreeView.cs
+++ b/SunnyUI/Controls/UITreeView.cs
@@ -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();
}
}
diff --git a/SunnyUI/Controls/UIUserControl.cs b/SunnyUI/Controls/UIUserControl.cs
index 3ad25afa..b709502a 100644
--- a/SunnyUI/Controls/UIUserControl.cs
+++ b/SunnyUI/Controls/UIUserControl.cs
@@ -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;
///
/// 主题样式
///
- [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();
}
///
@@ -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();
- }
}
}
diff --git a/SunnyUI/Style/UIStyleManager.cs b/SunnyUI/Style/UIStyleManager.cs
index d1ae017a..8b3b7f71 100644
--- a/SunnyUI/Style/UIStyleManager.cs
+++ b/SunnyUI/Style/UIStyleManager.cs
@@ -52,7 +52,7 @@ namespace Sunny.UI
///
/// 主题样式
///
- [DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
+ [DefaultValue(UIStyle.Inherited), Description("主题样式"), Category("SunnyUI")]
[Browsable(false)]
public UIStyle Style
{