【发布时间】:2010-12-16 18:15:02
【问题描述】:
我遇到了这样的问题
My form doesn't properly display when it is launched from another thread
现在我的问题是如何从自定义类而不是表单调用 Invoke 方法
void call_thread()
{
Thread t = new Thread(new ThreadStart(this.ShowForm1));
t.Start();
}
delegate void Func();
private void ShowForm1()
{
if (this.InvokeRequired) //error
{
Func f = new Func(ShowForm1);
this.Invoke(f); //error
}
else
{
Form1 form1 = new Form1();
form1.Show();
}
}
【问题讨论】:
标签: c#