Freigeben über


PrinterSettings.PaperSourceCollection.Count Eigenschaft

Definition

Ruft die Anzahl der verschiedenen Papierquellen in der Auflistung ab.

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

Eigenschaftswert

Die Anzahl der verschiedenen Papierquellen in der Sammlung.

Implementiert

Beispiele

Im folgenden Codebeispiel wird das comboPaperSource Kombinationsfeld mit den unterstützten Papierquellen des Druckers aufgefüllt. Die SourceName Eigenschaft wird als Eigenschaft identifiziert, die die Anzeigezeichenfolge für das Element bereitstellt, das über die DisplayMember Eigenschaft des Kombinationsfelds hinzugefügt wird. Das Beispiel erfordert, dass eine PrintDocument Variable mit dem Namen printDoc vorhanden ist und dass das jeweilige Kombinationsfeld vorhanden ist.

// Add list of paper sources found on the printer to the combo box.
// The DisplayMember property is used to identify the property that will provide the display String*.
comboPaperSource->DisplayMember = "SourceName";
PaperSource^ pkSource;
for ( int i = 0; i < printDoc->PrinterSettings->PaperSources->Count; i++ )
{
   pkSource = printDoc->PrinterSettings->PaperSources[ i ];
   comboPaperSource->Items->Add( pkSource );
}
// Add list of paper sources found on the printer to the combo box.
// The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSource.DisplayMember="SourceName";

PaperSource pkSource;
for (int i = 0; i < printDoc.PrinterSettings.PaperSources.Count; i++){
    pkSource = printDoc.PrinterSettings.PaperSources[i];
    comboPaperSource.Items.Add(pkSource);
}
' Add list of paper sources found on the printer to the combo box.
' The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSource.DisplayMember = "SourceName"

Dim pkSource As PaperSource
For i = 0 to printDoc.PrinterSettings.PaperSources.Count - 1
    pkSource = printDoc.PrinterSettings.PaperSources.Item(i)
    comboPaperSource.Items.Add(pkSource)
Next

Gilt für: