本文介绍了如何在form1到form2中启用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

        private void button13_Click(object sender, EventArgs e)
        {

Form2 f2 = new Form2();
f2.show
button13.enable=false;

}




并以表格2



我想通过此事件启用按钮13





and in form 2



i want to enable the button 13 through this event


private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {

}







how to do it

推荐答案


private void button13_Click(object sender, EventArgs e)
   {
   button13.Enable=false;
   Form2 f2 = new Form2();
   f2.FormClosing += new FormClosingEventHandler(f2_FormClosing);
   f2.Show();
   }

private void f2_FormClosing(object sender, FormClosingEventArgs e)
   {
   button13.Enable = true;
   }


private void Form2_Closing(...)
{
    Form2 form = sender as Form2;
    if (form.SomeValue == true)
    {
        button13.Enabled = true;
    }
}


这篇关于如何在form1到form2中启用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 09:21