* UISwitch:更新了Click判断事件。

This commit is contained in:
Sunny 2020-10-18 21:47:36 +08:00
parent 3f100fd419
commit 3317cb65ae
5 changed files with 14 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -946,6 +946,8 @@
this.uiSwitch1.Size = new System.Drawing.Size(75, 29); this.uiSwitch1.Size = new System.Drawing.Size(75, 29);
this.uiSwitch1.TabIndex = 45; this.uiSwitch1.TabIndex = 45;
this.uiSwitch1.Text = "uiSwitch1"; 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 // uiLine4
// //

View File

@ -17,5 +17,15 @@ namespace Sunny.UI.Demo
{ {
uiButton10.Selected = !uiButton10.Selected; 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);
}
} }
} }

View File

@ -159,16 +159,16 @@ namespace Sunny.UI
protected override void OnClick(EventArgs e) protected override void OnClick(EventArgs e)
{ {
base.OnClick(e);
Active = !Active; Active = !Active;
base.OnClick(e);
} }
protected override void OnDoubleClick(EventArgs e) protected override void OnDoubleClick(EventArgs e)
{ {
if (!UseDoubleClick) if (!UseDoubleClick)
{ {
base.OnClick(e);
Active = !Active; Active = !Active;
base.OnClick(e);
} }
else else
{ {