Share via


PaperSize Kelas

Definisi

Menentukan ukuran selembar kertas.

public ref class PaperSize
public class PaperSize
[System.Serializable]
public class PaperSize
type PaperSize = class
[<System.Serializable>]
type PaperSize = class
Public Class PaperSize
Warisan
PaperSize
Atribut

Contoh

Contoh kode berikut mengisi kotak comboPaperSize kombo dengan ukuran kertas yang didukung printer. Selain itu, ukuran kertas kustom dibuat dan ditambahkan ke kotak kombo. PaperName diidentifikasi sebagai properti yang akan menyediakan string tampilan untuk item yang ditambahkan melalui DisplayMember properti kotak kombo. Contoh mengasumsikan bahwa PrintDocument variabel bernama printDoc ada dan bahwa kotak kombo tertentu ada.

// Add list of supported paper sizes found on the printer.
// The DisplayMember property is used to identify the property that will provide the display String*.
comboPaperSize->DisplayMember = "PaperName";
PaperSize^ pkSize;
for ( int i = 0; i < printDoc->PrinterSettings->PaperSizes->Count; i++ )
{
   pkSize = printDoc->PrinterSettings->PaperSizes[ i ];
   comboPaperSize->Items->Add( pkSize );
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize^ pkCustomSize1 = gcnew PaperSize( "First custom size",100,200 );
comboPaperSize->Items->Add( pkCustomSize1 );
// Add list of supported paper sizes found on the printer. 
// The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName";

PaperSize pkSize;
for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
    pkSize = printDoc.PrinterSettings.PaperSizes[i];
    comboPaperSize.Items.Add(pkSize);
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

comboPaperSize.Items.Add(pkCustomSize1);
' Add list of supported paper sizes found on the printer. 
' The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName"

Dim pkSize As PaperSize
For i = 0 to printDoc.PrinterSettings.PaperSizes.Count - 1
    pkSize = printDoc.PrinterSettings.PaperSizes.Item(i)
    comboPaperSize.Items.Add(pkSize)
Next

' Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 100, 200)

comboPaperSize.Items.Add(pkCustomSize1)

Keterangan

Kelas ini digunakan oleh PrinterSettings.PaperSizes properti dan PageSettings.PaperSize untuk mendapatkan ukuran kertas yang tersedia pada printer dan untuk mengatur ukuran kertas untuk halaman, masing-masing.

Anda dapat menggunakan PaperSize konstruktor untuk menentukan ukuran kertas kustom. Nilai Width properti dan Height hanya dapat diatur untuk objek kustom PaperSize .

Untuk informasi selengkapnya tentang pencetakan, lihat System.Drawing.Printing gambaran umum namespace.

Konstruktor

PaperSize()

Menginisialisasi instans baru kelas PaperSize.

PaperSize(String, Int32, Int32)

Menginisialisasi instans baru kelas PaperSize.

Properti

Height

Mendapatkan atau mengatur tinggi kertas, dalam seratus inci.

Kind

Mendapatkan jenis kertas.

PaperName

Mendapatkan atau mengatur nama jenis kertas.

RawKind

Mendapatkan atau mengatur bilangan bulat yang mewakili salah PaperSize satu nilai atau nilai kustom.

Width

Mendapatkan atau mengatur lebar kertas, dalam seratus inci.

Metode

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()

Menyediakan informasi tentang PaperSize formulir dalam string.

Berlaku untuk

Lihat juga