C# static函数调用非static函数 改变控件属性 急!!!!
在winform窗体类form1中
void Start()
{
this.button1.enable = true;
}
//下面的这个Start方法已经在程序中调用了
在下面的静态函数中想把 控件button1的enable属性 设置为false
static void SetButtonAttribute()
{
this.button1.enable = false; //如果这样调用不行,因为在静态的函数中 不能引用this
//现在想实例化一个form1的类
form1 frm = new form1();
frm.button1.enable = false;
// 这样还是不行,因为frm.button1与上面的this.button1不同,达不到改变控件button1属性的效果
}
希各位大虾指点!!