从非UI线程打开Windows窗体

如何从非UI线程正确打开Windows窗体?

 var th = new Thread(() => { var form = new YourForm(); form.FormClosing += (s, e) => Application.ExitThread(); form.Show(); Application.Run(); }); th.SetApartmentState(ApartmentState.STA); th.Start(); 

您可以根据需要使用ShowDialog()和Show()方法。 访问以下链接查看示例

http://msdn.microsoft.com/en-us/library/39wcs2dh(v=vs.80).aspx