PageSettings PageSettings PageSettings PageSettings Class


Specifies settings that apply to a single, printed page.

public ref class PageSettings : ICloneable
public class PageSettings : ICloneable
type PageSettings = class
    interface ICloneable
Public Class PageSettings
Implements ICloneable


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 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);
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


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.


PageSettings() PageSettings() PageSettings() PageSettings()

Initializes a new instance of the PageSettings class using the default printer.

PageSettings(PrinterSettings) PageSettings(PrinterSettings) PageSettings(PrinterSettings) PageSettings(PrinterSettings)

Initializes a new instance of the PageSettings class using a specified printer.


Bounds Bounds Bounds Bounds

Gets the size of the page, taking into account the page orientation specified by the Landscape property.

Color Color Color Color

Gets or sets a value indicating whether the page should be printed in color.

HardMarginX HardMarginX HardMarginX HardMarginX

Gets the x-coordinate, in hundredths of an inch, of the hard margin at the left of the page.

HardMarginY HardMarginY HardMarginY HardMarginY

Gets the y-coordinate, in hundredths of an inch, of the hard margin at the top of the page.

Landscape Landscape Landscape Landscape

Gets or sets a value indicating whether the page is printed in landscape or portrait orientation.

Margins Margins Margins Margins

Gets or sets the margins for this page.

PaperSize PaperSize PaperSize PaperSize

Gets or sets the paper size for the page.

PaperSource PaperSource PaperSource PaperSource

Gets or sets the page's paper source; for example, the printer's upper tray.

PrintableArea PrintableArea PrintableArea PrintableArea

Gets the bounds of the printable area of the page for the printer.

PrinterResolution PrinterResolution PrinterResolution PrinterResolution

Gets or sets the printer resolution for the page.

PrinterSettings PrinterSettings PrinterSettings PrinterSettings

Gets or sets the printer settings associated with the page.


Clone() Clone() Clone() Clone()

Creates a copy of this PageSettings.

CopyToHdevmode(IntPtr) CopyToHdevmode(IntPtr) CopyToHdevmode(IntPtr) CopyToHdevmode(IntPtr)

Copies the relevant information from the PageSettings to the specified DEVMODE structure.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetHdevmode(IntPtr) SetHdevmode(IntPtr) SetHdevmode(IntPtr) SetHdevmode(IntPtr)

Copies relevant information to the PageSettings from the specified DEVMODE structure.

ToString() ToString() ToString() ToString()

Converts the PageSettings to string form.

Applies to

See also