PrintTicket.OutputColor 屬性

定義

取得或設定值,指出印表機如何處理有色彩或灰階的內容。

public:
 property Nullable<System::Printing::OutputColor> OutputColor { Nullable<System::Printing::OutputColor> get(); void set(Nullable<System::Printing::OutputColor> value); };
public System.Printing.OutputColor? OutputColor { get; set; }
member this.OutputColor : Nullable<System.Printing.OutputColor> with get, set
Public Property OutputColor As Nullable(Of OutputColor)

屬性值

OutputColor 值,指出印表機如何處理有色彩或灰階的內容。

例外狀況

呼叫程式碼嘗試將屬性設定為不屬於 OutputColor 列舉的值。

範例

下列範例示範如何使用這個屬性來設定列印作業。

// Use different PrintTickets for different FixedDocuments.
PrintTicket ptFD = new PrintTicket();

if (_firstDocumentPrintTicket <= 1)
{   // Print the first document in black/white and in portrait
    // orientation.  Since the PrintTicket at the
    // FixedDocumentSequence level already specifies portrait
    // orientation, this FixedDocument can just inherit that
    // setting without having to set it again.
    ptFD.PageOrientation = PageOrientation.Portrait;
    ptFD.OutputColor = OutputColor.Monochrome;
    _firstDocumentPrintTicket++;
}

else // if (_firstDocumentPrintTicket > 1)
{   // Print the second document in color and in landscape
    // orientation.  Since the PrintTicket at the
    // FixedDocumentSequence level already specifies portrait
    // orientation, this FixedDocument needs to set its
    // PrintTicket with landscape orientation in order to
    // override the higher level setting.
    ptFD.PageOrientation = PageOrientation.Landscape;
    ptFD.OutputColor = OutputColor.Color;
}
' Use different PrintTickets for different FixedDocuments.
Dim ptFD As New PrintTicket()

If _firstDocumentPrintTicket <= 1 Then
    ' orientation.  Since the PrintTicket at the
    ' FixedDocumentSequence level already specifies portrait
    ' orientation, this FixedDocument can just inherit that
    ' setting without having to set it again.
    ptFD.PageOrientation = PageOrientation.Portrait
    ptFD.OutputColor = OutputColor.Monochrome
    _firstDocumentPrintTicket += 1

Else ' if (_firstDocumentPrintTicket > 1)
    ' orientation.  Since the PrintTicket at the
    ' FixedDocumentSequence level already specifies portrait
    ' orientation, this FixedDocument needs to set its
    ' PrintTicket with landscape orientation in order to
    ' override the higher level setting.
    ptFD.PageOrientation = PageOrientation.Landscape
    ptFD.OutputColor = OutputColor.Color
End If

備註

null此屬性的值表示未指定這項功能設定。 此外,當值為 null時, () 的 XML 版本 PrintTicket 將不會 SaveToGetXmlStream 包含此功能的任何標記。

此屬性會對應至 列印架構PageOutputColor 關鍵詞。

您可以使用 屬性來測試印表機支援 OutputColorCapability 的選項。

適用於