您正在同步执行任务。因此,就用户所见而言,消息泵永远不会真正获得等待光标调用。
要解决此问题,您应该异步执行此操作。由于您使用的是 .NET 4.0,因此您可以使用任务并行库:
this.Cursor = Cursors.Wait
//Avoid any closure problems
string fileName = saveFileDialog.FileName
//Start the task of writing the xml (It will run on the next availabled thread)
var writeXmlTask = Task.Factory.StartNew(()=>dtResults.WriteXml(fileName));
//Use the created task to attach what the action will be whenever the task returns.
//Making sure to use the current UI thread to perform the processing
writeXmlTask.ContinueWith(
(previousTask)=>{this.Cursor = Cursors.Arrow;MessageBox.Show....}, TaskScheduler.FromCurrentSynchronizationContext());