CheckStateChanged(复选框选中状态更改事件)和 CheckedChanged(单选按钮选中状态更改事件)二者区别?

CheckStateChanged(复选框选中状态更改事件)和 CheckedChanged(单选按钮选中状态更改事件)二者区别:

复选框控件(CheckBox)提供了CheckedChanged控件的选择状态发生改变;双击即可进入CheckedChanged编辑界面,此按钮未提供CheckStateChanged事件。

单选按钮控件(RadioButton)提供了CheckStateChanged选中状态被更改,双击单选按钮,可进入CheckedChanged编辑界面。

 1 using System;
 2 using System.Data;
 3 using System.Drawing;
 4 using System.Text;
 5 using System.Windows.Forms;
 6 namespace Test18
 7 {
 8     public partial class Form1 : Form
 9     {
10         public Form1()
11         {
12             InitializeComponent();
13         }
14         private void checkBox1_CheckStateChanged(object sender, EventArgs e)
15         {
16             MessageBox.Show("控件的选择状态发生改变");
17         }
18 
19         private void Form1_Load(object sender, EventArgs e)
20         {
21 
22         }
23 
24         private void checkBox1_CheckedChanged(object sender, EventArgs e)
25         {
26 
27         }
28     }
29 }
 1 using System;
 2 using System.Data;
 3 using System.Drawing;
 4 using System.Text;
 5 using System.Windows.Forms;
 6 namespace Test20
 7 {
 8     public partial class Form1 : Form
 9     {
10         public Form1()
11         {
12             InitializeComponent();
13         }
14         private void radioButton1_CheckedChanged(object sender, EventArgs e)
15         {
16             MessageBox.Show("RadioButton1控件的选中状态被更改");
17         }
18         private void button1_Click(object sender, EventArgs e)
19         {
20             radioButton1.Checked = true;
21         }
22         private void button2_Click(object sender, EventArgs e)
23         {
24             radioButton1.Checked = false;
25         }
26         private void Form1_Load(object sender, EventArgs e)
27         {
28             radioButton1.Checked = true;
29         }
30     }
31 }

 

posted @ 2015-11-14 11:51  刘要直  阅读(9555)  评论(0编辑  收藏  举报