Freigeben über


PrinterSettings.PaperSizes-Eigenschaft

Ruft die von diesem Drucker unterstützten Papiergrößen ab.

Namespace: System.Drawing.Printing
Assembly: System.Drawing (in system.drawing.dll)

Syntax

'Declaration
Public ReadOnly Property PaperSizes As PaperSizeCollection
'Usage
Dim instance As PrinterSettings
Dim value As PaperSizeCollection

value = instance.PaperSizes
public PaperSizeCollection PaperSizes { get; }
public:
property PaperSizeCollection^ PaperSizes {
    PaperSizeCollection^ get ();
}
/** @property */
public PaperSizeCollection get_PaperSizes ()
public function get PaperSizes () : PaperSizeCollection

Eigenschaftenwert

Eine PrinterSettings.PaperSizeCollection, die die von diesem Drucker unterstützten Papiergrößen darstellt.

Hinweise

PrinterSettings.PaperSizeCollection enthält PaperSize-Instanzen, die die Papiergröße mithilfe der PaperSize.Kind-Eigenschaft darstellen, die einen der PaperKind-Werte enthält.

Üblicherweise legen Sie die Papiergröße der Seite mithilfe der PageSettings.PaperSize-Eigenschaft auf eine gültige PaperSize fest, die über die PaperSizes-Auflistung verfügbar ist.

Informationen zum Angeben einer benutzerdefinierten Papiergröße finden Sie unter dem PaperSize-Konstruktor.

Beispiel

Im folgenden Codebeispiel wird das comboPaperSize-Kombinationsfeld mit den unterstützten Papierformaten des Druckers aufgefüllt. Außerdem wird ein benutzerdefiniertes Papierformat erstellt und dem Kombinationsfeld hinzugefügt. Der PaperName wird als die Eigenschaft identifiziert, die die Anzeigezeichenfolge für das Element bereitstellt, das von der DisplayMember-Eigenschaft des Kombinationsfelds hinzugefügt wird. Im Beispiel müssen eine PrintDocument-Variable mit dem Namen printDoc und das bestimmte Kombinationsfeld vorhanden sein.

' 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)
// 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";
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.set_DisplayMember("PaperName");

PaperSize pkSize;
for (int i = 0; i < printDoc.get_PrinterSettings().get_PaperSizes().
    get_Count(); i++) {
    pkSize = printDoc.get_PrinterSettings().get_PaperSizes().
        get_Item(i);
    comboPaperSize.get_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.get_Items().Add(pkCustomSize1);

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

PrinterSettings-Klasse
PrinterSettings-Member
System.Drawing.Printing-Namespace
PaperSize-Klasse
PrinterSettings.PaperSizeCollection
PrinterSettings.InstalledPrinters-Eigenschaft
PaperSources
PrinterResolutions
ListControl.DisplayMember