public void Dispose()
 {
     m_report = null;
     m_paint = null;
     if (m_fPreview != null)
     {
         m_fPreview.Dispose();
     }
     m_rpwPrint = null;
 }
        // 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);
        }
 // TODO: see how to implement this functionality
 //
 private void m_fPreview_FormUnload()
 {
     m_rpwPrint = null;
     m_report.getLaunchInfo().getObjPaint().setReport(null);
     m_report.getLaunchInfo().setObjPaint(null);
 }
 public void setPreviewControl(CSReportPreview.cReportPreview rhs)
 {
     m_rpwPrint = rhs;
 }