void m_BackgroundWorker_CorrPlotCompleted(object sender, RunWorkerCompletedEventArgs e) { clsPlotResult mclsPlotResult; var mfrmCorrDisplay = new frmCorrDisplay(mclsCorrPar); mfrmShowProgress.Hide(); mfrmShowProgress.DialogResult = DialogResult.Cancel; //this.Focus(); if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (e.Cancelled) { // Next, handle the case where the user canceled // the operation. // Note that due to a race condition in // the DoWork event handler, the Cancelled // flag may not have been set, even though // CancelAsync was called. Console.WriteLine("Canceled"); } else { // Finally, handle the case where the operation // succeeded. //mfrmPlot.Image = e.Result as Image; //DialogResult dres = mfrmPlot.ShowDialog(); mclsPlotResult = (clsPlotResult)e.Result; mfrmCorrDisplay.Image = mclsPlotResult.mImage; mfrmCorrDisplay.PlotName = mclsPlotResult.mstrPlotName; mfrmCorrDisplay.DAnTEinstance = this; mfrmCorrDisplay.MdiParent = m_frmDAnTE.MdiParent; mfrmCorrDisplay.Title = "Correlations"; mfrmCorrDisplay.Show(); } }