PrinterSettings.PaperSizeCollection Kelas

Definisi

Berisi kumpulan PaperSize objek.

public: ref class PrinterSettings::PaperSizeCollection : System::Collections::ICollection
public class PrinterSettings.PaperSizeCollection : System.Collections.ICollection
type PrinterSettings.PaperSizeCollection = class
    interface ICollection
    interface IEnumerable
Public Class PrinterSettings.PaperSizeCollection
Implements ICollection
Warisan
PrinterSettings.PaperSizeCollection
Penerapan

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 menyediakan string tampilan untuk item yang ditambahkan melalui DisplayMember properti kotak kombo. Contohnya mengharuskan PrintDocument variabel bernama printDoc ada dan 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

PrinterSettings.PaperSizeCollection berisi PaperSize instans yang mewakili ukuran kertas melalui PaperSize.Kind properti , yang berisi salah PaperKind satu nilai.

Biasanya, Anda mengatur ukuran kertas halaman melalui PageSettings.PaperSize properti ke instans valid yang PaperSize tersedia melalui PaperSizes koleksi.

PaperSize Lihat konstruktor untuk mengetahui bagaimana Anda dapat menentukan ukuran kertas kustom.

Konstruktor

PrinterSettings.PaperSizeCollection(PaperSize[])

Menginisialisasi instans baru kelas PrinterSettings.PaperSizeCollection.

Properti

Count

Mendapatkan jumlah ukuran kertas yang berbeda dalam koleksi.

Item[Int32]

Mendapatkan pada PaperSize indeks tertentu.

Metode

Add(PaperSize)

PrinterResolution Menambahkan ke akhir koleksi.

CopyTo(PaperSize[], Int32)

Menyalin konten saat ini PrinterSettings.PaperSizeCollection ke array yang ditentukan, dimulai dari indeks yang ditentukan.

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetEnumerator()

Mengembalikan enumerator yang dapat melakukan iterasi melalui koleksi.

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

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Implementasi Antarmuka Eksplisit

ICollection.CopyTo(Array, Int32)

Untuk deskripsi anggota ini, lihat CopyTo(Array, Int32).

ICollection.Count

Untuk deskripsi anggota ini, lihat Count.

ICollection.IsSynchronized

Untuk deskripsi anggota ini, lihat IsSynchronized.

ICollection.SyncRoot

Untuk deskripsi anggota ini, lihat SyncRoot.

IEnumerable.GetEnumerator()

Untuk deskripsi anggota ini, lihat GetEnumerator().

Metode Ekstensi

Cast<TResult>(IEnumerable)

Mentransmisikan elemen dari ke IEnumerable jenis yang ditentukan.

OfType<TResult>(IEnumerable)

Memfilter elemen berdasarkan IEnumerable jenis yang ditentukan.

AsParallel(IEnumerable)

Mengaktifkan paralelisasi kueri.

AsQueryable(IEnumerable)

Mengonversi menjadi IEnumerableIQueryable.

Berlaku untuk

Lihat juga