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.
});