private void PreviewProc(object state) { try { PrintDocument document = (PrintDocument)state; _previewDialog = new PrintPreviewDialog(); _previewDialog.Text = "DICOM Print Preview"; _previewDialog.ShowInTaskbar = true; _previewDialog.WindowState = FormWindowState.Maximized; _previewDialog.Document = document; _previewDialog.FormClosed += delegate(object sender, FormClosedEventArgs e) { _previewDialog = null; }; _previewDialog.Show(Application.OpenForms[0]); _previewDialog.BringToFront(); _previewDialog.Focus(); } catch (Exception ex) { #if DEBUG Dicom.Debug.Log.Error("DICOM Print Error: " + ex.ToString()); #else Dicom.Debug.Log.Error("DICOM Print Error: " + ex.Message); #endif } }