PrinterSettings.PaperSourceCollection.Item[Int32] Propriedade

Definição

Obtém o PaperSource em um índice especificado.Gets the PaperSource at a specified index.

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.The index of the PaperSource to get.

Valor da propriedade

PaperSource

O PaperSource no índice especificado.The PaperSource at the specified index.

Exemplos

O exemplo de código a seguir popula a comboPaperSource caixa de combinação com as fontes de papel com suporte da impressora.The following code example populates the comboPaperSource combo box with the printer's supported paper sources. 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.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. O exemplo requer que uma PrintDocument variável nomeada printDoc exista e que a caixa de combinação específica exista.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

Aplica-se a

Confira também