/// <summary> /// 打印header和footer /// </summary> private void PrintCommon(Graphics graphics) { body.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Top, customPageMargin.Width, customPageMargin.Height); if (header != null) { if (this.CurrentPageIndex == 1 || header.PrintInEveryPage) { header.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Top, header.Rectangle.Width, header.Rectangle.Height); header.Draw(graphics); // body.Rectangle.Height=customPageMargin.Height-header.Rectangle.Height; body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y + header.Rectangle.Height, body.Rectangle.Width, body.Rectangle.Height - header.Rectangle.Height); } } if (footer != null) { if (this.CurrentPageIndex == 1 || footer.PrintInEveryPage) { body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y, body.Rectangle.Width, body.Rectangle.Height - footer.Rectangle.Height); footer.Rectangle = new Rectangle(customPageMargin.Left, body.Rectangle.Y + body.Rectangle.Height, body.Rectangle.Width, footer.Rectangle.Height); footer.Draw(graphics); } } if (this.IsPrinterPages) { FooterDraw draw = new FooterDraw(string.Format(this.PagesFormatter, new object[] { this.currentPageIndex, this.pages })); draw.Border = BordersEdgeStyle.None; draw.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Height + customPageMargin.Top - Printer_Pages_Height, customPageMargin.Width, Printer_Pages_Height); draw.Draw(graphics); body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y, body.Rectangle.Width, body.Rectangle.Height - Printer_Pages_Height); // draw.Rectangle=new Rectangle(this.customPageMargin.Top, // draw.Draw(graphics); } }
/// <summary> /// ��ӡheader��footer /// </summary> private void PrintCommon(Graphics graphics) { body.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Top, customPageMargin.Width, customPageMargin.Height); if (header != null) { if (this.CurrentPageIndex == 1 || header.PrintInEveryPage) { header.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Top, header.Rectangle.Width, header.Rectangle.Height); header.Draw(graphics); // body.Rectangle.Height=customPageMargin.Height-header.Rectangle.Height; body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y+header.Rectangle.Height, body.Rectangle.Width, body.Rectangle.Height - header.Rectangle.Height); } } if (footer != null) { if (this.CurrentPageIndex == 1 || footer.PrintInEveryPage) { body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y, body.Rectangle.Width, body.Rectangle.Height - footer.Rectangle.Height); footer.Rectangle = new Rectangle(customPageMargin.Left, body.Rectangle.Y + body.Rectangle.Height, body.Rectangle.Width, footer.Rectangle.Height); footer.Draw(graphics); } } if (this.IsPrinterPages) { FooterDraw draw=new FooterDraw(string.Format(this.PagesFormatter,new object[]{this.currentPageIndex,this.pages})); draw.Border = BordersEdgeStyle.None; draw.Rectangle = new Rectangle(customPageMargin.Left, customPageMargin.Height + customPageMargin.Top - Printer_Pages_Height, customPageMargin.Width, Printer_Pages_Height); draw.Draw(graphics); body.Rectangle = new Rectangle(body.Rectangle.X, body.Rectangle.Y, body.Rectangle.Width, body.Rectangle.Height - Printer_Pages_Height); // draw.Rectangle=new Rectangle(this.customPageMargin.Top, // draw.Draw(graphics); } }