private void button1_Click(object sender, EventArgs e)
{
this.button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
this.button1.Enabled = true;
}
你这不是送分吗
送分
禁用控件:
1.将控件隐藏:
在button1的click事件中将button1的可见性设为false
private void button1_Click(object sender, EventArgs e)
{
this.button1.visable= false;
}
然后再button2的click的事件中将button1的可见性设为true
private void button2_Click(object sender, EventArgs e)
{
this.button1.visable = ftrue;
}
2.任然显示控件,但不实现该控件的任何功能,也就是不启用该控件
private void button1_Click(object sender, EventArgs e)
{
this.button1.Enabled = false;
}
在button2的click事件中启用button1
private void button2_Click(object sender, EventArgs e)
{
this.button1.Enabled = true;
}