void m_BackgroundWorker_HistPlotCompleted(object sender, RunWorkerCompletedEventArgs e) { clsPlotResult mclsPlotResult; var mfrmHistDisplay = new frmHistDisplay(mclsHistPar); //mfrmShowProgress.Hide(); 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; mfrmHistDisplay.Image = mclsPlotResult.mImage; mfrmHistDisplay.PlotName = mclsPlotResult.mstrPlotName; mfrmHistDisplay.DAnTEinstance = this; mfrmHistDisplay.MdiParent = m_frmDAnTE.MdiParent; mfrmHistDisplay.Title = "Histograms"; mfrmHistDisplay.Show(); } }