Name

PrintPageEventArgs

Synopsis

This class encapsulates the data for the PrintDocument.PrintPage event.

You should handle this event and paint the page’s imagery on the supplied Graphics surface. To determine how the page should be printed, you can use the MarginBounds, PageBounds, and PageSettings.

If the document contains more pages that need printing, you should set the HasMorePages property to true, but if not, set it to false and the print job will be completed.

To abandon the print job, you can set the Cancel property.


public class PrintPageEventArgs : EventArgs {

// Public Constructors

   public PrintPageEventArgs(System.Drawing.Graphics graphics, System.Drawing.Rectangle marginBounds, 

        System.Drawing.Rectangle pageBounds, PageSettings pageSettings);

// Public Instance Properties

   public bool Cancel{set; get; }

   public Graphics Graphics{get; }

   public bool HasMorePages{set; get; }

   public Rectangle MarginBounds{get; }

   public Rectangle PageBounds{get; }

   public PageSettings PageSettings{get; }

}

Hierarchy

System.Object System.EventArgs PrintPageEventArgs

Passed To

PrintController.{OnEndPage(), OnStartPage()}, PrintDocument.OnPrintPage(), PrintPageEventHandler.{BeginInvoke(), Invoke()}

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.