PaperSource.SourceName Свойство

Определение

Получает или задает название источника бумаги.

public:
 property System::String ^ SourceName { System::String ^ get(); void set(System::String ^ value); };
public:
 property System::String ^ SourceName { System::String ^ get(); };
public string SourceName { get; set; }
public string SourceName { get; }
member this.SourceName : string with get, set
member this.SourceName : string
Public Property SourceName As String
Public ReadOnly Property SourceName As String

Значение свойства

Имя источника бумаги.

Примеры

В следующем примере кода поле со списком comboPaperSource заполняется поддерживаемыми источниками бумаги принтера. Определяется SourceName как свойство, предоставляющее отображаемую строку для добавляемого элемента с помощью DisplayMember свойства поля со списком. В этом примере требуется, чтобы переменная PrintDocument с именем printDoc существовала, а конкретное поле со списком существовало.

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

Комментарии

Вызывайте это свойство, когда необходимо отобразить источник бумаги. Имя источника бумаги создается на Kind основе свойства .

Применяется к

См. также раздел