BeginInvoke也需要一个static函数啊,在static函数里面怎么操作控件啊?? 我是这么写的,在static方法中: Form1 fm = new Form1(); fm.BeginInvoke(new delFunction(OperateControl)); OperateControl函数也必须是static才行啊,那怎么操作控件呢?谢谢
新new的窗体和你显示的窗体是2个窗体static 1个 fm 主窗体 初始化的时候指向 主窗体static 函数里 fm.BeginInvoke(new delFunction(fm.OperateControl))
我是这么写的,在static方法中:
Form1 fm = new Form1();
fm.BeginInvoke(new delFunction(OperateControl));
OperateControl函数也必须是static才行啊,那怎么操作控件呢?谢谢
fm.BeginInvoke(new delFunction(fm.OperateControl))
public delegate void delFunction();
static Form1 fm;
public Form1()
{
InitializeComponent();
fm = this;
}
static void staticFunction()
{
fm.BeginInvoke(new delFunction(fm.OperateControl));
}
private void OperateControl()
{
this.label1.Text = "111";
}