请教各位大大为什么会这样?
以下代码button2_Click与 button3_Click为button2与button3已绑定事件处理程序,当用户轮流点击button2和button3若干次后,再点击button1时出现系统CPU100%,请问为什么?应如何解决?
private void button2_Click(object sender, EventArgs e)
{
this.button1.Click += new EventHandler(button1_Click);
}
private void button3_Click(object sender, EventArgs e)
{
this.button1.Click -= new EventHandler(button1_Click);
}
private void button1_Click(object sender, EventArgs e)
{
this.Text = DateTime.Now.ToString();
}