PageSettings Class
Specifies settings that apply to a single, printed page.
Assembly: System.Drawing (in System.Drawing.dll)
The PageSettings class is used to specify settings that modify the way a page will be printed. Typically, you set default settings for all pages to be printed through the PrintDocument.DefaultPageSettings property. To specify settings on a page-by-page basis, handle the PrintDocument.PrintPage or PrintDocument.QueryPageSettings event and modify the PageSettings argument included in the PrintPageEventArgs or QueryPageSettingsEventArgs, respectively.
For more information about handling PrintDocument events, see the PrintDocument class overview. For more information about printing, see the System.Drawing.Printing namespace overview.
The following example demonstrates handling the PrintPage event and checking the PageSettings argument of PrintPageEventArgs. To use this code, add a PrintDocument component named PrintDocument1 to a Windows Form and associate its PrintPage event with the printDocument1_PrintPage method in the example.
Private Sub printDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocument1.PrintPage If e.PageSettings.Color AndAlso Not printDocument1.PrinterSettings.SupportsColor Then MessageBox.Show("Color printing not supported on selected printer.", "Printer Warning", MessageBoxButtons.OKCancel) End If End Sub
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.