Exemplo n.º 1
0
 private void LoadForm()
 {
     //SetReportName();
     InitialPageSize();
     pages.Clear();
     RemoveReportControl();
     if (report.ReportPages.Count > 0)
     {
         for (int i = 0; i < report.ReportPages.Count; i++)
         {
             ReportPageUI pageUI = new ReportPageUI(report.ReportPages[i]);
             if (i == 0) //开始时设置第一页为当前页
             {
                 pageUI.IsSelected  = true;
                 this.tslPages.Text = "Page: 1/" + report.ReportPages.Count.ToString();
             }
             SetPageBounds(pageUI, i + 1);
             //   pageUI.Top += this.toolStrip.Height;
             pages.Add(pageUI);
             this.reportLayout.Controls.Add(pageUI);
         }
     }
     else
     {
         NewReportPage();
     }
 }
Exemplo n.º 2
0
        private void SetPageBounds(ReportPageUI page, int pageNo)
        {
            int top  = this.reportLayout.AutoScrollPosition.Y;
            int left = this.reportLayout.AutoScrollPosition.X;

            pagesInOnline = this.Width / pageWidth < 1 ? 1 : this.Width / pageWidth; // calculate how many pages display in one line

            if (pagesInOnline > 1)
            {
                if (this.Width < (pageWidth * pagesInOnline) + pagesLeftSpace * (pagesInOnline - 1))
                {
                    pagesInOnline -= 1;
                }
            }
            // calculate page belong to which column.
            int pageColumn    = (pageNo % pagesInOnline) == 0 ? pagesInOnline : pageNo % pagesInOnline; // data from 1;
            int firstPageLeft = (this.Width - ((pageWidth * pagesInOnline) + pagesLeftSpace * (pagesInOnline - 1))) / 2 <= 0 ? 1
                : (this.Width - ((pageWidth * pagesInOnline) + pagesLeftSpace * (pagesInOnline - 1))) / 2;
            int pageLeft = firstPageLeft + ((pageColumn - 1) * (pageWidth + pagesLeftSpace)) + left;

            // calculate page top
            pageNo = (int)(Math.Ceiling((pageNo / (double)pagesInOnline)));         //pageNo data from 1;
            int pageTop = (pageHeight * (pageNo - 1) + pagesSpace * (pageNo + 1) + top);

            page.Bounds = new Rectangle(new Point(pageLeft, pageTop),
                                        new Size(pageWidth, pageHeight));

            pnlSpace.Location = new Point(pageLeft, pageTop + pageHeight);
            pnlSpace.SendToBack();
        }
Exemplo n.º 3
0
        private void NewReportPage()
        {
            ReportPage   reportPage = new ReportPage();
            ReportPageUI NewPageUI  = new ReportPageUI(reportPage);

            NewPageUI.ReportCtrlChanged += new EventHandler <ArrayChangedEventArgs <ReportCtrl> >(pageUI_ReportCtrlChanged);
            SetPageBounds(NewPageUI, report.ReportPages.Count + 1);
            report.ReportPages.Add(reportPage);
            pages.Add(NewPageUI);
            this.reportLayout.Controls.Add(NewPageUI);
            reportLayout.AutoScrollPosition = new Point(0, -reportLayout.AutoScrollPosition.Y + 1169);
            //ReportOperateManage.SetSeletectedPage();
        }
Exemplo n.º 4
0
        private void PrintReport(Graphics g, ReportPageUI reportPageUI)
        {
            isPrinting = true;
            this.Invoke(new Action(() =>
            {
                //reportPageUI.DrawPageHeadAndTail(g);

                for (int i = reportPageUI.Controls.Count - 1; i >= 0; i--)
                {
                    ReportCtrl rCtrl = reportPageUI.Controls[i] as ReportCtrl;
                    if (rCtrl != null)
                    {
                        rCtrl.IsPrint = true;
                        rCtrl.Draw(g, rCtrl.ReportItem.Bounds);
                        rCtrl.IsPrint = false;
                    }
                }
            }));
            isPrinting = false;
        }