diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index bd40b5b5..70390304 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index f6ab87fd..e6e7921e 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll index cfb050fa..021f4cc1 100644 Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll index 0152cd59..a69033b3 100644 Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll index 09cf1a16..54add391 100644 Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs index 60a9fd23..e71a6158 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.Designer.cs @@ -70,6 +70,7 @@ this.uiCheckBox1.Size = new System.Drawing.Size(150, 35); this.uiCheckBox1.TabIndex = 0; this.uiCheckBox1.Text = "uiCheckBox1"; + this.uiCheckBox1.CheckedChanged += new System.EventHandler(this.uiCheckBox1_CheckedChanged); // // uiLine1 // @@ -146,6 +147,7 @@ this.uiCheckBoxGroup1.Size = new System.Drawing.Size(670, 211); this.uiCheckBoxGroup1.TabIndex = 41; this.uiCheckBoxGroup1.Text = "UICheckBoxGroup"; + this.uiCheckBoxGroup1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiCheckBoxGroup1.ValueChanged += new Sunny.UI.UICheckBoxGroup.OnValueChanged(this.uiCheckBoxGroup1_ValueChanged); // // uiButton1 @@ -210,7 +212,6 @@ // // FCheckBox // - this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(800, 556); this.Name = "FCheckBox"; diff --git a/SunnyUI.Demo/Controls/FCheckBox.cs b/SunnyUI.Demo/Controls/FCheckBox.cs index d57ea35d..25eb989b 100644 --- a/SunnyUI.Demo/Controls/FCheckBox.cs +++ b/SunnyUI.Demo/Controls/FCheckBox.cs @@ -49,5 +49,10 @@ namespace Sunny.UI.Demo { uiCheckBoxGroup1.Clear(); } + + private void uiCheckBox1_CheckedChanged(object sender, EventArgs e) + { + Console.WriteLine(uiCheckBox1.Checked); + } } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FRadioButton.Designer.cs b/SunnyUI.Demo/Controls/FRadioButton.Designer.cs index d591a0a6..d265462d 100644 --- a/SunnyUI.Demo/Controls/FRadioButton.Designer.cs +++ b/SunnyUI.Demo/Controls/FRadioButton.Designer.cs @@ -294,6 +294,7 @@ this.uiRadioButton1.Size = new System.Drawing.Size(150, 35); this.uiRadioButton1.TabIndex = 45; this.uiRadioButton1.Text = "uiRadioButton1"; + this.uiRadioButton1.CheckedChanged += new System.EventHandler(this.uiRadioButton1_CheckedChanged); // // uiLine2 // @@ -329,6 +330,7 @@ this.uiRadioButtonGroup1.Size = new System.Drawing.Size(670, 173); this.uiRadioButtonGroup1.TabIndex = 63; this.uiRadioButtonGroup1.Text = "UIRadioButtonGroup"; + this.uiRadioButtonGroup1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiRadioButtonGroup1.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.uiRadioButtonGroup1_ValueChanged); // // uiButton4 @@ -357,7 +359,6 @@ // // FRadioButton // - this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.ClientSize = new System.Drawing.Size(800, 598); this.Name = "FRadioButton"; diff --git a/SunnyUI.Demo/Controls/FRadioButton.cs b/SunnyUI.Demo/Controls/FRadioButton.cs index cbb0de1a..071e7712 100644 --- a/SunnyUI.Demo/Controls/FRadioButton.cs +++ b/SunnyUI.Demo/Controls/FRadioButton.cs @@ -30,5 +30,10 @@ namespace Sunny.UI.Demo { uiRadioButtonGroup1.SelectedIndex = 6; } + + private void uiRadioButton1_CheckedChanged(object sender, EventArgs e) + { + Console.WriteLine(uiRadioButton1.Checked); + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UICheckBox.cs b/SunnyUI/Controls/UICheckBox.cs index 32976103..8a1f5033 100644 --- a/SunnyUI/Controls/UICheckBox.cs +++ b/SunnyUI/Controls/UICheckBox.cs @@ -29,7 +29,7 @@ using System.Windows.Forms; namespace Sunny.UI { - [DefaultEvent("ValueChanged")] + [DefaultEvent("CheckedChanged")] [DefaultProperty("Checked")] [ToolboxItem(true)] public class UICheckBox : UIControl @@ -37,7 +37,7 @@ namespace Sunny.UI public UICheckBox() { SetStyleFlags(); - Cursor = Cursors.Hand; + base.Cursor = Cursors.Hand; ShowRect = false; Size = new Size(150, 29); foreColor = UIStyles.Blue.CheckBoxForeColor; @@ -130,10 +130,13 @@ namespace Sunny.UI { _checked = value; ValueChanged?.Invoke(this, _checked); + CheckedChanged?.Invoke(this, new EventArgs()); Invalidate(); } } + public event EventHandler CheckedChanged; + protected override void OnPaintFore(Graphics g, GraphicsPath path) { //设置按钮标题位置 diff --git a/SunnyUI/Controls/UIRadioButton.cs b/SunnyUI/Controls/UIRadioButton.cs index 058c6a8d..aa2f74c8 100644 --- a/SunnyUI/Controls/UIRadioButton.cs +++ b/SunnyUI/Controls/UIRadioButton.cs @@ -30,7 +30,7 @@ using System.Windows.Forms; namespace Sunny.UI { - [DefaultEvent("ValueChanged")] + [DefaultEvent("CheckedChanged")] [DefaultProperty("Checked")] [ToolboxItem(true)] public sealed class UIRadioButton : UIControl @@ -39,6 +39,8 @@ namespace Sunny.UI public event OnValueChanged ValueChanged; + public event EventHandler CheckedChanged; + public UIRadioButton() { SetStyleFlags(); @@ -150,6 +152,7 @@ namespace Sunny.UI } ValueChanged?.Invoke(this, _checked); + CheckedChanged?.Invoke(this, new EventArgs()); Invalidate(); } }