public bool closePreviewWindow() { try { if (m_fPreview != null) { m_fPreview.Dispose(); m_fPreview = null; } return true; } catch (Exception ex) { cError.mngError(ex, "ClosePreviewWindow", C_MODULE, ""); return false; } }
// if the caller hasn't assigned a preview object // we use the internal preview object // private void setPreviewForm() { if (m_rpwPrint == null) { if (m_fPreview == null) { m_fPreview = new fPreview(); } m_rpwPrint = m_fPreview.getRpwReport(); } else { if (m_rpwPrint.Parent != null) { if (!(m_rpwPrint.Parent.GetType() == typeof(Form))) { m_fPreview = new fPreview(); m_rpwPrint = m_fPreview.getRpwReport(); } } else { m_fPreview = new fPreview(); m_rpwPrint = m_fPreview.getRpwReport(); } } RectangleF tR; cPrinter w_printer = m_report.getLaunchInfo().getPrinter(); tR = cGlobals.getRectFromPaperSize(w_printer.getPaperInfo(), w_printer.getPaperInfo().getPaperSize(), w_printer.getPaperInfo().getOrientation()); m_realWidth = (int)tR.Width; m_realHeight = (int)tR.Height; m_rpwPrint.getBody().Width = (int)m_realWidth; m_rpwPrint.getBody().Height = (int)m_realHeight; if (!m_bModal) { if (!m_bHidePreviewWindow) { var obj = m_rpwPrint.getParent(); if (obj.GetType() == typeof(Form)) { Form f = obj as Form; f.Show(); } } } m_rpwPrint.getBody().Paint += new PaintEventHandler(rpwPrintBodyPaint); m_rpwPrint.FirstPage += new CSReportPreview.FirstPage(rpwPrintMoveFirst); m_rpwPrint.PreviousPage += new CSReportPreview.PreviousPage(rpwPrintMovePrevious); m_rpwPrint.MoveToPage += new CSReportPreview.MoveToPage(rpwPrintMoveToPage); m_rpwPrint.NextPage += new CSReportPreview.NextPage(rpwPrintMoveNext); m_rpwPrint.LastPage += new CSReportPreview.LastPage(rpwPrintMoveLast); }