PageSettings 類別

定義

指定要套用到單一列印頁面的設定。

public ref class PageSettings : ICloneable
public class PageSettings : ICloneable
[System.Runtime.InteropServices.ComVisible(false)]
public class PageSettings : ICloneable
[System.Serializable]
public class PageSettings : ICloneable
type PageSettings = class
    interface ICloneable
[<System.Runtime.InteropServices.ComVisible(false)>]
type PageSettings = class
    interface ICloneable
[<System.Serializable>]
type PageSettings = class
    interface ICloneable
Public Class PageSettings
Implements ICloneable
繼承
PageSettings
屬性
實作

範例

下列範例示範如何處理 PrintPage 事件,並檢查 PageSettingsPrintPageEventArgs自變數。 若要使用此程式代碼,請將名為 PrintDocument1 的元件新增PrintDocument至 Windows Form,並將其事件與printDocument1_PrintPage範例中的 方法產生關聯PrintPage

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

備註

類別 PageSettings 是用來指定修改列印頁面方式的設定。 一般而言,您會設定要透過 PrintDocument.DefaultPageSettings 屬性列印之所有頁面的預設設定。 若要逐頁指定設定,請分別處理 PrintDocument.PrintPagePrintDocument.QueryPageSettings 事件,並修改 PageSettingsQueryPageSettingsEventArgs中包含的PrintPageEventArgs自變數。

如需處理 PrintDocument 事件的詳細資訊,請參閱 PrintDocument 類別概觀。 如需列印的詳細資訊,請參閱 System.Drawing.Printing 命名空間概觀。

注意

在 .NET 6 和更新版本中,只有 Windows 作業系統才支援包含此類型的 System.Drawing.Common 套件。 在跨平臺應用程式中使用此類型會導致編譯時期警告和運行時間例外狀況。 如需詳細資訊,請參閱 僅限 Windows 上支援的 System.Drawing.Common

建構函式

PageSettings()

使用預設的印表機來初始化 PageSettings 類別的新執行個體。

PageSettings(PrinterSettings)

使用指定的印表機來初始化 PageSettings 類別的新執行個體。

屬性

Bounds

取得頁面的大小,並將 Landscape 屬性所指定的頁面方向列入考量。

Color

取得或設定值,指出頁面是否應該以彩色列印。

HardMarginX

取得位於頁面左側之強制邊界的 X 座標 (以百分之一英吋為單位)。

HardMarginY

取得位於頁面頂端之強制邊界的 Y 座標 (以百分之一英吋為單位)。

Landscape

取得或設定值,指出橫印或直印頁面。

Margins

取得或設定這個頁面的邊界。

PaperSize

取得或設定這個頁面的紙張大小。

PaperSource

取得或設定頁面的紙張來源 (例如,印表機的上層紙匣)。

PrintableArea

取得印表機之頁面可列印區域的界限。

PrinterResolution

取得或設定這個頁面的印表機解析度。

PrinterSettings

取得或設定這個頁面相關的各項設定。

方法

Clone()

建立這個 PageSettings 的複本。

CopyToHdevmode(IntPtr)

將相關資訊從 PageSettings 複製到指定的 DEVMODE 結構。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
SetHdevmode(IntPtr)

從指定的 DEVMODE 結構將相關資訊複製至 PageSettings

ToString()

PageSettings 轉換成字串格式。

適用於

另請參閱