PrinterSettings.PaperSourceCollection.Count Property

Definition

Получает число разных источников бумаги в коллекции.Gets the number of different paper sources in the collection.

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

Property Value

Int32

Число разных источников бумаги в коллекции.The number of different paper sources in the collection.

Implements

Examples

Следующий пример кода заполняет поле со списком comboPaperSource поддерживаемыми источниками бумаги принтера.The following code example populates the comboPaperSource combo box with the printer's supported paper sources. SourceName определяется как свойство, которое предоставляет отображаемую строку для элемента, добавляемого с помощью свойства DisplayMember поля со списком.The SourceName is identified as the property that provides the display string for the item being added through the DisplayMember property of the combo box. Для этого примера требуется, чтобы PrintDocumentая переменная с именем printDoc существовала и было задано конкретное поле со списком.The example requires that a PrintDocument variable named printDoc exists and that the specific combo box exists.

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

Applies to