diff --git a/SunnyUI/Controls/UICheckBox.cs b/SunnyUI/Controls/UICheckBox.cs
index b2780ce3..755bf4b0 100644
--- a/SunnyUI/Controls/UICheckBox.cs
+++ b/SunnyUI/Controls/UICheckBox.cs
@@ -23,6 +23,7 @@
* 2022-03-19: V3.1.1 重构主题配色
* 2023-05-12: V3.3.6 重构DrawString函数
* 2023-11-07: V3.5.2 增加修改图标大小
+ * 2023-12-04: V3.6.1 增加属性可修改图标大小
******************************************************************************/
using System;
@@ -66,8 +67,8 @@ namespace Sunny.UI
if (AutoSize && Dock == DockStyle.None)
{
Size sf = TextRenderer.MeasureText(Text, Font);
- int w = sf.Width + ImageSize + 3;
- int h = Math.Max(ImageSize, sf.Height) + 2;
+ int w = sf.Width + CheckBoxSize + 3;
+ int h = Math.Max(CheckBoxSize, sf.Height) + 2;
if (Width != w) Width = w;
if (Height != h) Height = h;
}
@@ -107,20 +108,8 @@ namespace Sunny.UI
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
- [Browsable(false)]
+ [Browsable(true)]
public int CheckBoxSize
- {
- get => ImageSize;
- set => ImageSize = value;
- }
-
- ///
- /// 图标大小
- ///
- [DefaultValue(16)]
- [Description("图标大小"), Category("SunnyUI")]
- [Browsable(false)]
- public int ImageSize
{
get => _imageSize;
set
@@ -202,12 +191,11 @@ namespace Sunny.UI
/// 绘图路径
protected override void OnPaintFill(Graphics g, GraphicsPath path)
{
+ int ImageSize = CheckBoxSize;
//图标
float top = (Height - ImageSize) / 2.0f;
float left = Text.IsValid() ? ImageInterval : (Width - ImageSize) / 2.0f;
-
Color color = Enabled ? fillColor : foreDisableColor;
-
if (Checked)
{
g.FillRoundRectangle(color, new Rectangle((int)left, (int)top, ImageSize, ImageSize), 1);
diff --git a/SunnyUI/Controls/UICheckBoxGroup.cs b/SunnyUI/Controls/UICheckBoxGroup.cs
index 6eecf55f..88d5befe 100644
--- a/SunnyUI/Controls/UICheckBoxGroup.cs
+++ b/SunnyUI/Controls/UICheckBoxGroup.cs
@@ -25,6 +25,7 @@
* 2023-04-19: V3.3.5 设置选择项ForeColor
* 2023-06-27: V3.3.9 内置条目关联值由Tag改为TagString
* 2023-11-07: V3.5.2 重写UICheckBoxGroup
+ * 2023-12-04: V3.6.1 增加属性可修改图标大小
******************************************************************************/
using System;
@@ -97,7 +98,7 @@ namespace Sunny.UI
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
- [Browsable(false)]
+ [Browsable(true)]
public int CheckBoxSize
{
get => _imageSize;
diff --git a/SunnyUI/Controls/UIRadioButton.cs b/SunnyUI/Controls/UIRadioButton.cs
index e588f27f..9c39f13b 100644
--- a/SunnyUI/Controls/UIRadioButton.cs
+++ b/SunnyUI/Controls/UIRadioButton.cs
@@ -24,6 +24,7 @@
* 2022-12-21: V3.3.0 修复CheckedChanged事件
* 2023-05-12: V3.3.6 重构DrawString函数
* 2023-11-07: V3.5.2 增加修改图标大小
+ * 2023-12-04: V3.6.1 增加属性可修改图标大小
******************************************************************************/
using System;
@@ -67,8 +68,8 @@ namespace Sunny.UI
if (AutoSize && Dock == DockStyle.None)
{
Size sf = TextRenderer.MeasureText(Text, Font);
- int w = sf.Width + ImageSize + 3;
- int h = Math.Max(ImageSize, sf.Height) + 2;
+ int w = sf.Width + RadioButtonSize + 3;
+ int h = Math.Max(RadioButtonSize, sf.Height) + 2;
if (Width != w) Width = w;
if (Height != h) Height = h;
}
@@ -108,17 +109,8 @@ namespace Sunny.UI
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
- [Browsable(false)]
+ [Browsable(true)]
public int RadioButtonSize
- {
- get => ImageSize;
- set => ImageSize = value;
- }
-
- [DefaultValue(16)]
- [Description("按钮图片大小"), Category("SunnyUI")]
- [Browsable(false)]
- public int ImageSize
{
get => _imageSize;
set
@@ -201,6 +193,7 @@ namespace Sunny.UI
/// 绘图路径
protected override void OnPaintFill(Graphics g, GraphicsPath path)
{
+ int ImageSize = RadioButtonSize;
//图标
float top = (Height - ImageSize) / 2.0f;
float left = Text.IsValid() ? ImageInterval : (Width - ImageSize) / 2.0f;
diff --git a/SunnyUI/Controls/UIRadioButtonGroup.cs b/SunnyUI/Controls/UIRadioButtonGroup.cs
index d8f70d91..ab04acd3 100644
--- a/SunnyUI/Controls/UIRadioButtonGroup.cs
+++ b/SunnyUI/Controls/UIRadioButtonGroup.cs
@@ -24,6 +24,7 @@
* 2023-04-22: V3.3.5 设置选择项ForeColor
* 2023-06-27: V3.3.9 内置条目关联值由Tag改为TagString
* 2023-11-09: V3.5.2 重写UIRadioButtonGroup
+ * 2023-12-04: V3.6.1 增加属性可修改图标大小
******************************************************************************/
using System;
@@ -177,7 +178,7 @@ namespace Sunny.UI
[DefaultValue(16)]
[Description("图标大小"), Category("SunnyUI")]
- [Browsable(false)]
+ [Browsable(true)]
public int RadioButtonSize
{
get => _imageSize;