Bagikan melalui


PrintTicket.PageOrientation Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan bagaimana konten halaman berorientasi untuk pencetakan.

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

Nilai Properti

PageOrientation Nilai yang menentukan bagaimana konten halaman berorientasi, misalnya, Landscape atau ReversePortrait.

Pengecualian

Kode panggilan telah mencoba mengatur properti ke nilai yang tidak ada dalam PageOrientation enumerasi.

Contoh

Contoh berikut menunjukkan cara menggunakan properti ini untuk mengonfigurasi pekerjaan cetak.

// 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

Keterangan

Nilai null untuk properti ini berarti bahwa pengaturan fitur ini tidak ditentukan. Selain itu, ketika nilainya adalah null, versi XML dari PrintTicket (lihat SaveTo dan GetXmlStream) tidak akan berisi markup apa pun untuk fitur ini.

Properti ini sesuai dengan kata kunci SkemaPageOrientation Cetak.

Anda dapat menguji opsi yang didukung printer dengan menggunakan PageOrientationCapability properti .

Berlaku untuk