.NET Framework Class Library
PageSettings Class

Specifies settings that apply to a single, printed page.

Namespace:  System.Drawing.Printing
Assembly:  System.Drawing (in System.Drawing.dll)
Syntax

Visual Basic (Declaration)
<SerializableAttribute> _
Public Class PageSettings _
    Implements ICloneable
Visual Basic (Usage)
Dim instance As PageSettings
C#
[SerializableAttribute]
public class PageSettings : ICloneable
Visual C++
[SerializableAttribute]
public ref class PageSettings : ICloneable
JScript
public class PageSettings implements ICloneable
Remarks

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.

Examples

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.

Visual Basic
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
C#
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);
}
Inheritance Hierarchy

System..::.Object
  System.Drawing.Printing..::.PageSettings
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

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.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Page view tracker