* UICheckBox,UIRadioButton:增加默认事件CheckedChanged
This commit is contained in:
parent
47d633531a
commit
3215b5ba46
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
SunnyUI.Demo/Controls/FCheckBox.Designer.cs
generated
3
SunnyUI.Demo/Controls/FCheckBox.Designer.cs
generated
@ -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";
|
||||
|
@ -49,5 +49,10 @@ namespace Sunny.UI.Demo
|
||||
{
|
||||
uiCheckBoxGroup1.Clear();
|
||||
}
|
||||
|
||||
private void uiCheckBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine(uiCheckBox1.Checked);
|
||||
}
|
||||
}
|
||||
}
|
3
SunnyUI.Demo/Controls/FRadioButton.Designer.cs
generated
3
SunnyUI.Demo/Controls/FRadioButton.Designer.cs
generated
@ -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";
|
||||
|
@ -30,5 +30,10 @@ namespace Sunny.UI.Demo
|
||||
{
|
||||
uiRadioButtonGroup1.SelectedIndex = 6;
|
||||
}
|
||||
|
||||
private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine(uiRadioButton1.Checked);
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
//设置按钮标题位置
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user