PrinterSettings.PaperSourceCollection.Item[Int32] Propriété

Définition

Obtient l’index PaperSource spécifié.

public:
 virtual property System::Drawing::Printing::PaperSource ^ default[int] { System::Drawing::Printing::PaperSource ^ get(int index); };
public virtual System.Drawing.Printing.PaperSource this[int index] { get; }
member this.Item(int) : System.Drawing.Printing.PaperSource
Default Public Overridable ReadOnly Property Item(index As Integer) As PaperSource

Paramètres

index
Int32

Index de l’objet PaperSource à obtenir.

Valeur de propriété

À PaperSource l’index spécifié.

Exemples

L’exemple de code suivant remplit la comboPaperSource zone de liste modifiable avec les sources papier prises en charge par l’imprimante. La SourceName propriété est identifiée comme la propriété qui fournit la chaîne d’affichage de l’élément ajouté via la DisplayMember propriété de la zone de liste déroulante. L’exemple nécessite qu’une PrintDocument variable nommée printDoc existe et que la zone de liste modifiable spécifique existe.

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

S’applique à

Voir aussi