Occurs immediately before each PrintPage event.
Assembly: System.Drawing (in System.Drawing.dll)
It is possible to print each page of a document using different page settings. You set page settings by modifying individual properties of the QueryPageSettingsEventArgs.PageSettings property or by setting the property to a PageSettings. Changes made to the PageSettings affect only the current page, not the document's default page settings. The print job can also be canceled by setting the Cancel property to true for the QueryPageSettingsEventArgs.
To associate the event with your event handler, add an instance of the QueryPageSettingsEventHandler delegate to the event. The event handler is called whenever the event occurs. For more information about handling events with delegates, see Handling and Raising Events.
The following code example prints a document with the first page in color, if the printer supports it. The example requires that a PrintDocument variable named printDoc has been created, and the PrintPage and events are handled. The currentPageNumber variable is incremented after every page is printed in the PrintPage event, which is not shown.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.