Esempio n. 1
0
 public void RemovePage(ReportPage p)
 {
     if (p != null)
     {
         p.Release();
     }
     _ReportPageList.Remove(p);
 }
Esempio n. 2
0
        private void DrawPage(ReportPage p, MyRectF clipRect, ref float htmlWidth, ref float htmlHeight, bool isExport = false, Extension ext = null)          //todo: qiuleilei
        {
            if (_Pages == null)
            {
                return;
            }
            PointF location = new PointF(0, 0);

            if (p.PageType == ReportPageType.Data)
            {
                //页眉
                MyRectF rfC = rectfPool.Get();
                SetRectF(rfC, clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin) - 1,
                         clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageHeadHeight));
                var top    = rfC.Top;
                var height = rfC.Height;
//				if (htmlWidth == -1f) {
//					htmlWidth = rfC.Width;
//				}
//				if (htmlHeight == -1f) {
//					htmlHeight = rfC.Height;
//				}
                if (ext != null)
                {
                    ext.ReportPageType2Html(p, rfC, _Pages.PageHeadBackColor, isExport);
                }

                foreach (ReportElement pi in p.PageManager.PageHeadReportElements)
                {
                    if (pi.Tag is IVisibleExpression)
                    {
                        string str = (pi.Tag as IVisibleExpression).VisibleExpression;
                        if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)))
                        {
                            object o = _Pages.ReportRuntime.ExpressionEngine.Execute(str, _Pages.ReportRuntime.DataTables, "");
                            if (o != null)
                            {
                                bool bVisible = Convert.ToBoolean(o);
                                if (!bVisible)
                                {
                                    if (pi.Tag is IPanelElement)
                                    {
                                        SetDrawingChildControlVisibleExpression(pi.Tag as Control, str);
                                    }
                                    continue;
                                }
                            }
                        }
                    }

                    SetPointF(ref location, InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    pi.Draw(location, _Pages.ReportRuntime, rfC, isExport, ext);
                }

                //数据区
                rfC = rectfPool.Get();
                SetRectF(rfC, clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin + _Pages.PageHeadHeight) - 1,
                         clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageDataRegionHeight));

                if (ext != null)
                {
                    ext.ReportPageType2Html(p, rfC, _Pages.DataRegionBackColor, isExport);
                }

                foreach (ReportElement pi in p.Elements)
                {
                    SetPointF(ref location, InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageHeadHeight + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    if (location.Y < top)
                    {
                        location.Y = top + height;
                        //pi.Height=
                    }
                    pi.Draw(location, _Pages.ReportRuntime, rfC, isExport, ext);
                }

                //页脚
                rfC = rectfPool.Get();
                SetRectF(rfC, clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin + _Pages.PageHeadHeight + _Pages.PageDataRegionHeight) - 1,
                         clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageFootHeight));

                if (ext != null)
                {
                    ext.ReportPageType2Html(p, rfC, _Pages.PageFootBackColor, isExport);
                }



                foreach (ReportElement pi in p.PageManager.PageFootReportElements)
                {
                    if (pi.Tag is IVisibleExpression)
                    {
                        string str = (pi.Tag as IVisibleExpression).VisibleExpression;
                        if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)))
                        {
                            object o = _Pages.ReportRuntime.ExpressionEngine.Execute(str, _Pages.ReportRuntime.DataTables, "");
                            if (o != null)
                            {
                                bool bVisible = Convert.ToBoolean(o);
                                if (!bVisible)
                                {
                                    if (pi.Tag is IPanelElement)
                                    {
                                        SetDrawingChildControlVisibleExpression(pi.Tag as Control, str);
                                    }
                                    continue;
                                }
                            }
                        }
                    }

                    //PointF location = pointfPool.Get ();
                    SetPointF(ref location, InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageHeadHeight + p.PageManager.PageTopMargin + p.PageManager.PageDataRegionHeight) + _Top - _vScroll);
                    pi.Page = p;
                    pi.Draw(location, _Pages.ReportRuntime, rfC, isExport, ext);
                }
            }
            else                 //报表头、报表尾
                                 //数据区
            {
                MyRectF rfC = rectfPool.Get();
                SetRectF(rfC, clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin) - 1,
                         clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageDrawRegionHeight));
//				if (htmlWidth == -1f) {
//					htmlWidth = rfC.Width;
//				}
//				if (htmlHeight == -1f) {
//					htmlHeight = rfC.Height;
//				}
                var top    = rfC.Top;
                var height = rfC.Height;
                if (p.PageType == ReportPageType.ReportHead)
                {
                    if (ext != null)
                    {
                        ext.ReportPageType2Html(p, rfC, _Pages.ReportHeadBackColor, isExport);
                    }
                }
                else
                {
                    if (ext != null)
                    {
                        ext.ReportPageType2Html(p, rfC, _Pages.ReportFootBackColor, isExport);
                    }
                }
                foreach (ReportElement pi in p.Elements)
                {
                    //PointF location = pointfPool.Get ();
                    SetPointF(ref location, InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    if (location.Y < top)
                    {
                        location.Y = top + height;
                        //pi.Height=
                    }
                    pi.Draw(location, _Pages.ReportRuntime, rfC, isExport, ext);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 绘制报表页
        /// </summary>
        /// <param name="g"></param>
        /// <param name="p"></param>
        /// <param name="clipRect"></param>
        private void DrawPage(Graphics g, ReportPage p, System.Drawing.RectangleF clipRect, bool isExport = false, Extension ext = null)          //todo: qiuleilei
        {
            if (_Pages == null)
            {
                return;
            }
            if (p.PageType == ReportPageType.Data)
            {
                //页眉
                RectangleF rfC = new RectangleF(clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin) - 1,
                                                clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageHeadHeight));
                g.SetClip(rfC);
                var top    = rfC.Top;
                var height = rfC.Height;
                using (SolidBrush brh = new SolidBrush(_Pages.PageHeadBackColor)) {
                    g.FillRectangle(brh, rfC);
                    if (ext != null)
                    {
                        ext.ReportPageType2Html(p, rfC, _Pages.PageHeadBackColor, isExport);
                    }
                }
                foreach (ReportElement pi in p.PageManager.PageHeadReportElements)
                {
                    if (pi.Tag is IVisibleExpression)
                    {
                        string str = (pi.Tag as IVisibleExpression).VisibleExpression;
                        if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)))
                        {
                            object o = _Pages.ReportRuntime.ExpressionEngine.Execute(str, _Pages.ReportRuntime.DataTables, "");
                            if (o != null)
                            {
                                bool bVisible = Convert.ToBoolean(o);
                                if (!bVisible)
                                {
                                    if (pi.Tag is IPanelElement)
                                    {
                                        SetDrawingChildControlVisibleExpression(pi.Tag as Control, str);
                                    }
                                    continue;
                                }
                            }
                        }
                    }

                    PointF location = new PointF(InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    pi.Draw(g, location, _Pages.ReportRuntime, rfC, isExport, ext);
                }

                //数据区
                rfC = new RectangleF(clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin + _Pages.PageHeadHeight) - 1,
                                     clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageDataRegionHeight));

                g.SetClip(rfC);

                using (SolidBrush brh = new SolidBrush(_Pages.DataRegionBackColor)) {
                    g.FillRectangle(brh, rfC);
                    if (ext != null)
                    {
                        ext.ReportPageType2Html(p, rfC, _Pages.DataRegionBackColor, isExport);
                    }
                }
                foreach (ReportElement pi in p.Elements)
                {
                    PointF location = new PointF(InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageHeadHeight + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    if (location.Y < top)
                    {
                        location.Y = top + height;
                        //pi.Height=
                    }
                    pi.Draw(g, location, _Pages.ReportRuntime, rfC, isExport, ext);
                }

                //页脚
                rfC = new RectangleF(clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin + _Pages.PageHeadHeight + _Pages.PageDataRegionHeight) - 1,
                                     clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageFootHeight));
                g.SetClip(rfC);

                using (SolidBrush brh = new SolidBrush(_Pages.PageFootBackColor)) {
                    g.FillRectangle(brh, rfC);
                    if (ext != null)
                    {
                        ext.ReportPageType2Html(p, rfC, _Pages.PageFootBackColor, isExport);
                    }
                }

                foreach (ReportElement pi in p.PageManager.PageFootReportElements)
                {
                    if (pi.Tag is IVisibleExpression)
                    {
                        string str = (pi.Tag as IVisibleExpression).VisibleExpression;
                        if (!string.IsNullOrEmpty(str) && ((str.IndexOf("PageIndex") >= 0 || str.IndexOf("PageCount") >= 0)))
                        {
                            object o = _Pages.ReportRuntime.ExpressionEngine.Execute(str, _Pages.ReportRuntime.DataTables, "");
                            if (o != null)
                            {
                                bool bVisible = Convert.ToBoolean(o);
                                if (!bVisible)
                                {
                                    if (pi.Tag is IPanelElement)
                                    {
                                        SetDrawingChildControlVisibleExpression(pi.Tag as Control, str);
                                    }
                                    continue;
                                }
                            }
                        }
                    }

                    PointF location = new PointF(InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageHeadHeight + p.PageManager.PageTopMargin + p.PageManager.PageDataRegionHeight) + _Top - _vScroll);
                    pi.Page = p;
                    pi.Draw(g, location, _Pages.ReportRuntime, rfC, isExport, ext);
                }
            }
            else                 //报表头、报表尾
                                 //数据区
            {
                RectangleF rfC = new RectangleF(clipRect.X + InchesToPixelX(_Pages.PageLeftMargin), clipRect.Y + InchesToPixelY(_Pages.PageTopMargin) - 1,
                                                clipRect.Width - (InchesToPixelX(_Pages.PageRightMargin) + InchesToPixelX(_Pages.PageLeftMargin)), InchesToPixelY(_Pages.PageDrawRegionHeight));
                g.SetClip(rfC);

                if (p.PageType == ReportPageType.ReportHead)
                {
                    using (SolidBrush brh = new SolidBrush(_Pages.ReportHeadBackColor)) {
                        g.FillRectangle(brh, rfC);
                        if (ext != null)
                        {
                            ext.ReportPageType2Html(p, rfC, _Pages.ReportHeadBackColor, isExport);
                        }
                    }
                }
                else
                {
                    using (SolidBrush brh = new SolidBrush(_Pages.ReportFootBackColor)) {
                        g.FillRectangle(brh, rfC);
                        if (ext != null)
                        {
                            ext.ReportPageType2Html(p, rfC, _Pages.ReportFootBackColor, isExport);
                        }
                    }
                }
                foreach (ReportElement pi in p.Elements)
                {
                    PointF location = new PointF(InchesToPixelX(pi.Location.X + _Pages.PageLeftMargin) + _Left - _hScroll, InchesToPixelY(pi.Location.Y + p.PageManager.PageTopMargin) + _Top - _vScroll);
                    pi.Page = p;
                    pi.Draw(g, location, _Pages.ReportRuntime, rfC, isExport, ext);
                }
            }
        }
Esempio n. 4
0
 public void AddPage(ReportPage p)
 {
     _ReportPageList.Add(p);
     _currentPage = p;
 }