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

王朝学院·作者佚名  2016-08-28
窄屏简体版  字體: 小  |  中  |  大  |  超大  

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}

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航