diff --git a/Bin/SunnyUI.Demo.exe b/Bin/SunnyUI.Demo.exe index 557561c8..1a10b24c 100644 Binary files a/Bin/SunnyUI.Demo.exe and b/Bin/SunnyUI.Demo.exe differ diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index aa9e575a..6e1fc2fd 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FButton.Designer.cs b/SunnyUI.Demo/Controls/FButton.Designer.cs index 5ab05368..33495bad 100644 --- a/SunnyUI.Demo/Controls/FButton.Designer.cs +++ b/SunnyUI.Demo/Controls/FButton.Designer.cs @@ -946,6 +946,8 @@ this.uiSwitch1.Size = new System.Drawing.Size(75, 29); this.uiSwitch1.TabIndex = 45; this.uiSwitch1.Text = "uiSwitch1"; + this.uiSwitch1.ValueChanged += new Sunny.UI.UISwitch.OnValueChanged(this.uiSwitch1_ValueChanged); + this.uiSwitch1.Click += new System.EventHandler(this.uiSwitch1_Click); // // uiLine4 // diff --git a/SunnyUI.Demo/Controls/FButton.cs b/SunnyUI.Demo/Controls/FButton.cs index a56cbf88..39e9fae2 100644 --- a/SunnyUI.Demo/Controls/FButton.cs +++ b/SunnyUI.Demo/Controls/FButton.cs @@ -17,5 +17,15 @@ namespace Sunny.UI.Demo { uiButton10.Selected = !uiButton10.Selected; } + + private void uiSwitch1_ValueChanged(object sender, bool value) + { + Console.WriteLine(uiSwitch1.Active); + } + + private void uiSwitch1_Click(object sender, EventArgs e) + { + Console.WriteLine(uiSwitch1.Active); + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UISwitch.cs b/SunnyUI/Controls/UISwitch.cs index 0593620a..80f75c1e 100644 --- a/SunnyUI/Controls/UISwitch.cs +++ b/SunnyUI/Controls/UISwitch.cs @@ -159,16 +159,16 @@ namespace Sunny.UI protected override void OnClick(EventArgs e) { - base.OnClick(e); Active = !Active; + base.OnClick(e); } protected override void OnDoubleClick(EventArgs e) { if (!UseDoubleClick) { - base.OnClick(e); Active = !Active; + base.OnClick(e); } else {