CheckStateChanged(复选框选中状态更改事件)和 CheckedChanged(单选按钮选中状态更改事件)二者区别:
复选框控件(CheckBox)提供了CheckedChanged控件的选择状态发生改变;双击即可进入CheckedChanged编辑界面,此按钮未提供CheckStateChanged事件。
单选按钮控件(RadioButton)提供了CheckStateChanged选中状态被更改,双击单选按钮,可进入CheckedChanged编辑界面。
1usingSystem;2usingSystem.Data;3usingSystem.Drawing;4usingSystem.Text;5usingSystem.Windows.Forms;6namespaceTest187{8publicpartialclassForm1 : Form9{10publicForm1()11{12InitializeComponent();13}14PRivatevoidcheckBox1_CheckStateChanged(objectsender, EventArgs e)15{16MessageBox.Show("控件的选择状态发生改变");17}1819privatevoidForm1_Load(objectsender, EventArgs e)20{2122}2324privatevoidcheckBox1_CheckedChanged(objectsender, EventArgs e)25{2627}28}29}
1usingSystem;2usingSystem.Data;3usingSystem.Drawing;4usingSystem.Text;5usingSystem.Windows.Forms;6namespaceTest207{8publicpartialclassForm1 : Form9{10publicForm1()11{12InitializeComponent();13}14privatevoidradioButton1_CheckedChanged(objectsender, EventArgs e)15{16MessageBox.Show("RadioButton1控件的选中状态被更改");17}18privatevoidbutton1_Click(objectsender, EventArgs e)19{20radioButton1.Checked =true;21}22privatevoidbutton2_Click(objectsender, EventArgs e)23{24radioButton1.Checked =false;25}26privatevoidForm1_Load(objectsender, EventArgs e)27{28radioButton1.Checked =true;29}30}31}