* 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.Size = new System.Drawing.Size(150, 35);
|
||||||
this.uiCheckBox1.TabIndex = 0;
|
this.uiCheckBox1.TabIndex = 0;
|
||||||
this.uiCheckBox1.Text = "uiCheckBox1";
|
this.uiCheckBox1.Text = "uiCheckBox1";
|
||||||
|
this.uiCheckBox1.CheckedChanged += new System.EventHandler(this.uiCheckBox1_CheckedChanged);
|
||||||
//
|
//
|
||||||
// uiLine1
|
// uiLine1
|
||||||
//
|
//
|
||||||
@ -146,6 +147,7 @@
|
|||||||
this.uiCheckBoxGroup1.Size = new System.Drawing.Size(670, 211);
|
this.uiCheckBoxGroup1.Size = new System.Drawing.Size(670, 211);
|
||||||
this.uiCheckBoxGroup1.TabIndex = 41;
|
this.uiCheckBoxGroup1.TabIndex = 41;
|
||||||
this.uiCheckBoxGroup1.Text = "UICheckBoxGroup";
|
this.uiCheckBoxGroup1.Text = "UICheckBoxGroup";
|
||||||
|
this.uiCheckBoxGroup1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.uiCheckBoxGroup1.ValueChanged += new Sunny.UI.UICheckBoxGroup.OnValueChanged(this.uiCheckBoxGroup1_ValueChanged);
|
this.uiCheckBoxGroup1.ValueChanged += new Sunny.UI.UICheckBoxGroup.OnValueChanged(this.uiCheckBoxGroup1_ValueChanged);
|
||||||
//
|
//
|
||||||
// uiButton1
|
// uiButton1
|
||||||
@ -210,7 +212,6 @@
|
|||||||
//
|
//
|
||||||
// FCheckBox
|
// FCheckBox
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 556);
|
this.ClientSize = new System.Drawing.Size(800, 556);
|
||||||
this.Name = "FCheckBox";
|
this.Name = "FCheckBox";
|
||||||
|
@ -49,5 +49,10 @@ namespace Sunny.UI.Demo
|
|||||||
{
|
{
|
||||||
uiCheckBoxGroup1.Clear();
|
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.Size = new System.Drawing.Size(150, 35);
|
||||||
this.uiRadioButton1.TabIndex = 45;
|
this.uiRadioButton1.TabIndex = 45;
|
||||||
this.uiRadioButton1.Text = "uiRadioButton1";
|
this.uiRadioButton1.Text = "uiRadioButton1";
|
||||||
|
this.uiRadioButton1.CheckedChanged += new System.EventHandler(this.uiRadioButton1_CheckedChanged);
|
||||||
//
|
//
|
||||||
// uiLine2
|
// uiLine2
|
||||||
//
|
//
|
||||||
@ -329,6 +330,7 @@
|
|||||||
this.uiRadioButtonGroup1.Size = new System.Drawing.Size(670, 173);
|
this.uiRadioButtonGroup1.Size = new System.Drawing.Size(670, 173);
|
||||||
this.uiRadioButtonGroup1.TabIndex = 63;
|
this.uiRadioButtonGroup1.TabIndex = 63;
|
||||||
this.uiRadioButtonGroup1.Text = "UIRadioButtonGroup";
|
this.uiRadioButtonGroup1.Text = "UIRadioButtonGroup";
|
||||||
|
this.uiRadioButtonGroup1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.uiRadioButtonGroup1.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.uiRadioButtonGroup1_ValueChanged);
|
this.uiRadioButtonGroup1.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.uiRadioButtonGroup1_ValueChanged);
|
||||||
//
|
//
|
||||||
// uiButton4
|
// uiButton4
|
||||||
@ -357,7 +359,6 @@
|
|||||||
//
|
//
|
||||||
// FRadioButton
|
// FRadioButton
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 598);
|
this.ClientSize = new System.Drawing.Size(800, 598);
|
||||||
this.Name = "FRadioButton";
|
this.Name = "FRadioButton";
|
||||||
|
@ -30,5 +30,10 @@ namespace Sunny.UI.Demo
|
|||||||
{
|
{
|
||||||
uiRadioButtonGroup1.SelectedIndex = 6;
|
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
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[DefaultEvent("ValueChanged")]
|
[DefaultEvent("CheckedChanged")]
|
||||||
[DefaultProperty("Checked")]
|
[DefaultProperty("Checked")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
public class UICheckBox : UIControl
|
public class UICheckBox : UIControl
|
||||||
@ -37,7 +37,7 @@ namespace Sunny.UI
|
|||||||
public UICheckBox()
|
public UICheckBox()
|
||||||
{
|
{
|
||||||
SetStyleFlags();
|
SetStyleFlags();
|
||||||
Cursor = Cursors.Hand;
|
base.Cursor = Cursors.Hand;
|
||||||
ShowRect = false;
|
ShowRect = false;
|
||||||
Size = new Size(150, 29);
|
Size = new Size(150, 29);
|
||||||
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
foreColor = UIStyles.Blue.CheckBoxForeColor;
|
||||||
@ -130,10 +130,13 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
_checked = value;
|
_checked = value;
|
||||||
ValueChanged?.Invoke(this, _checked);
|
ValueChanged?.Invoke(this, _checked);
|
||||||
|
CheckedChanged?.Invoke(this, new EventArgs());
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler CheckedChanged;
|
||||||
|
|
||||||
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
||||||
{
|
{
|
||||||
//设置按钮标题位置
|
//设置按钮标题位置
|
||||||
|
@ -30,7 +30,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[DefaultEvent("ValueChanged")]
|
[DefaultEvent("CheckedChanged")]
|
||||||
[DefaultProperty("Checked")]
|
[DefaultProperty("Checked")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
public sealed class UIRadioButton : UIControl
|
public sealed class UIRadioButton : UIControl
|
||||||
@ -39,6 +39,8 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public event OnValueChanged ValueChanged;
|
public event OnValueChanged ValueChanged;
|
||||||
|
|
||||||
|
public event EventHandler CheckedChanged;
|
||||||
|
|
||||||
public UIRadioButton()
|
public UIRadioButton()
|
||||||
{
|
{
|
||||||
SetStyleFlags();
|
SetStyleFlags();
|
||||||
@ -150,6 +152,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
ValueChanged?.Invoke(this, _checked);
|
ValueChanged?.Invoke(this, _checked);
|
||||||
|
CheckedChanged?.Invoke(this, new EventArgs());
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user