Specifies settings that apply to a single, printed page.
Namespace:
System.Drawing.Printing
Assembly:
System.Drawing (in System.Drawing.dll)
Visual Basic (Declaration)
<SerializableAttribute> _
Public Class PageSettings _
Implements ICloneable
Dim instance As PageSettings
[SerializableAttribute]
public class PageSettings : ICloneable
[SerializableAttribute]
public ref class PageSettings : ICloneable
public class PageSettings implements ICloneable
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
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
if (e.PageSettings.Color && !printDocument1.PrinterSettings.SupportsColor)
MessageBox.Show("Color printing not supported on selected printer.", "Printer Warning", MessageBoxButtons.OKCancel);
}
System..::.Object
System.Drawing.Printing..::.PageSettings
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
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.
.NET Framework
Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Reference