/// <summary> /// 添加页对象 /// </summary> /// <param name="myPage"></param> public void Add(PrintPage myPage) { if (!this.InnerList.Contains(myPage)) { this.InnerList.Add(myPage); } }
/// <summary> /// 创建一个新页 /// </summary> /// <returns></returns> public PrintPage NewPage() { PrintPage NewPage = new PrintPage(); //myItems.Add( NewPage ); NewPage.OwnerPages = this; NewPage.Height = this.StandardHeight; NewPage.Width = this.StandardWidth; return(NewPage); }
/// <summary> /// 根据页面位置添加矩形区域转换关系 /// </summary> /// <param name="myTransform">转换列表</param> /// <param name="ForPrint">是否为打印进行填充</param> public void AddPage(PrintPage page, int PageTop, float ZoomRate) { System.Drawing.Rectangle rect = System.Drawing.Rectangle.Empty; int leftmargin = (int)(myPages.LeftMargin * ZoomRate); int topmargin = (int)(myPages.TopMargin * ZoomRate); int rightmargin = (int)(myPages.RightMargin * ZoomRate); int bottommargin = (int)(myPages.BottomMargin * ZoomRate); int pagewidth = (int)(myPages.PaperWidth * ZoomRate); int pageheight = (int)(myPages.PaperHeight * ZoomRate); int Top = PageTop + topmargin; SimpleRectangleTransform item = null; if (myPages.HeadHeight > 0) { item = new SimpleRectangleTransform(); item.PageIndex = page.Index; item.Flag2 = 0; item.Tag = page; item.DescRect = new System.Drawing.Rectangle( 0, 0, page.Width, myPages.HeadHeight); Top = SetSourceRect(item, ZoomRate, leftmargin, Top); this.Add(item); } item = new SimpleRectangleTransform(); item.PageIndex = page.Index; item.Flag2 = 1; item.Tag = page; item.DescRect = new System.Drawing.Rectangle( 0, page.Top, page.Width, page.Height); Top = SetSourceRect(item, ZoomRate, leftmargin, Top); this.Add(item); if (myPages.FooterHeight > 0) { item = new SimpleRectangleTransform(); item.PageIndex = page.Index; item.Flag2 = 2; item.Tag = page; item.DescRect = new System.Drawing.Rectangle( 0, myPages.DocumentHeight - myPages.FooterHeight, page.Width, myPages.FooterHeight); SetSourceRect(item, ZoomRate, leftmargin, Top); rect = item.SourceRect; Top = PageTop + pageheight - bottommargin - rect.Height; item.SourceRect = new System.Drawing.Rectangle(leftmargin, Top, rect.Width, rect.Height); this.Add(item); } }
/// <summary> /// 判断是否存在指定的页对象 /// </summary> /// <param name="page">页对象</param> /// <returns>是否存在页对象</returns> public bool Contains(PrintPage page) { return(this.List.Contains(page)); }
/// <summary> /// 删除指定页 /// </summary> /// <param name="myPage"></param> public void Remove(PrintPage myPage) { this.InnerList.Remove(myPage); }
/// <summary> /// 获得从0开始的序号 /// </summary> /// <param name="myPage"></param> /// <returns></returns> public int IndexOf(PrintPage myPage) { return(this.InnerList.IndexOf(myPage)); }