Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在多线程应用程序中设置鼠标光标_C#_Multithreading - Fatal编程技术网

C# 在多线程应用程序中设置鼠标光标

C# 在多线程应用程序中设置鼠标光标,c#,multithreading,C#,Multithreading,我有一个C#应用程序,我在workerthread中处理一些事情。 在启动workerthread之前,我尝试在主线程的Button Click事件中更改鼠标光标。 现在我想知道为什么光标没有改变 private void barButtonItemBulkImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Cursor.Current = Cursors.WaitCu

我有一个C#应用程序,我在workerthread中处理一些事情。 在启动workerthread之前,我尝试在主线程的Button Click事件中更改鼠标光标。 现在我想知道为什么光标没有改变

    private void barButtonItemBulkImport_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
    {
      Cursor.Current = Cursors.WaitCursor;        
      PxDAL pdal = new PxDAL();
      pdal.ReactivateAdressMutation += new PxDAL.Del_ReactivateAdressMutation(ReactivateAdressMutation);

      pdal.StartContact();
    }

    private void ReactivateAdressMutation()
    {
        if (this.InvokeRequired)
        {
            this.Invoke(new AdressMutation.Del_BatchImportFinished(ReactivateAdressMutation), new Object[] { });
        }
        else
        {
            Cursor.Current = Cursors.Default;
        }
    }
我的代码出了什么问题?

如果您尝试一下该怎么办

this.cursor = Cursors.WaitCursor;   

分别

this.cursor = Cursors.Default;