PrinterSettings.PaperSourceCollection.Item[Int32] Propriedade

Definição

Obtém o PaperSource em um índice especificado.

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

Parâmetros

index
Int32

O índice do PaperSource a obter.

Valor da propriedade

O PaperSource no índice especificado.

Exemplos

O exemplo de código a seguir preenche a comboPaperSource caixa de combinação com as fontes de papel com suporte da impressora. O SourceName é identificado como a propriedade que fornece a cadeia de caracteres de exibição para o item que está sendo adicionado por meio da DisplayMember propriedade da caixa de combinação. O exemplo requer que exista uma PrintDocument variável chamada printDoc e que a caixa de combinação específica exista.

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

Aplica-se a

Confira também