0
我想使用线程并在执行一些操作后关闭表单。但是我得到一个交叉线程错误.solutions?使用线程时出现交叉线程错误
new System.Threading.Thread(s =>
{
Close; }).Start();
我想使用线程并在执行一些操作后关闭表单。但是我得到一个交叉线程错误.solutions?使用线程时出现交叉线程错误
new System.Threading.Thread(s =>
{
Close; }).Start();
你必须但close();声明此为WPF
Application.Current.Dispatcher.Invoke(() =>
{
// Code to run on the UI thread.
});
,并在本作的WinForms
this.BeginInvoke(new MethodInvoker(delegate
{
// Code to run on the UI thread.
});