如何从非UI线程正确打开Windows窗体?
答案 0 :(得分:5)
var th = new Thread(() =>
{
var form = new YourForm();
form.FormClosing += (s, e) => Application.ExitThread();
form.Show();
Application.Run();
});
th.SetApartmentState(ApartmentState.STA);
th.Start();
答案 1 :(得分:0)
根据您的要求,您可以使用ShowDialog()和Show()方法。请访问以下链接查看示例
http://msdn.microsoft.com/en-us/library/39wcs2dh(v=vs.80).aspx