checkBox1_CheckedChanged(object sender, EventArgs e)和checkBox1_CheckStateChanged(object sender, EventArgs e)不同

时间:2021-08-26 23:01:04
 using System;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Test18
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckStateChanged(object sender, EventArgs e)
{
MessageBox.Show("控件的选择状态发生改变");
} private void Form1_Load(object sender, EventArgs e)
{ } private void checkBox1_CheckedChanged(object sender, EventArgs e)
{ }
}
}

checkBox1_CheckedChanged(object sender, EventArgs e)和checkBox1_CheckStateChanged(object sender, EventArgs e)不同

当我们双击窗体的时候,就进入了private void Form1_Load(object sender, EventArgs e)编写界面;

双击Label就进入了private void checkBox1_CheckedChanged(object sender, EventArgs e)编辑界面;

单击Label再右键属性,切换到事件,会找到checkBox1_CheckStateChanged选项,双击进入编辑界面,用以表示空间的选择状态发生改变时进行相应处理。