private void BeginPageLayout(object sender, BeginPageLayoutEventArgs e) { int index = e.Page.Section.Pages.IndexOf(e.Page); float offset = 50; PdfSolidBrush brush = new PdfSolidBrush(Color.LightBlue); if (index % 2 == 0) { RectangleF bounds = e.Bounds; e.Page.Graphics.DrawEllipse(brush, bounds.Width / 2 - offset, bounds.Height / 2 - offset, 2 * offset, 2 * offset); } else { RectangleF bounds = e.Bounds; e.Page.Graphics.DrawRectangle(brush, bounds.Width / 2 - offset, bounds.Height / 2 - offset, 2 * offset, 2 * offset); } }
private void BeginPageLayout2(object sender, BeginPageLayoutEventArgs e) { RectangleF bounds = e.Bounds; // First column. if (!m_paginateStart) { bounds.X = bounds.Width + 20f; bounds.Y = 10f; } else { // Second column. bounds.X = 0f; m_paginateStart = false; } e.Bounds = bounds; m_columnBounds = bounds; }
/// <summary> /// Draw graphic elements in the page. /// </summary> private void BeginPageLayout(object sender, BeginPageLayoutEventArgs e) { int index = e.Page.Section.Pages.IndexOf(e.Page); float offset = 50; PdfSolidBrush brush = new PdfSolidBrush(new PdfColor(System.Drawing.Color.FromArgb(255, 173, 216, 230))); // Ellipse for odd numbered pages. if (index % 2 == 0) { RectangleF bounds = e.Bounds; e.Page.Graphics.DrawEllipse(brush, bounds.Width / 2 - offset, bounds.Height / 2 - offset, 2 * offset, 2 * offset); } // Rectangle for even numbered pages. else { RectangleF bounds = e.Bounds; e.Page.Graphics.DrawRectangle(brush, bounds.Width / 2 - offset, bounds.Height / 2 - offset, 2 * offset, 2 * offset); } }