PaperSource.SourceName 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定紙張來源的名稱。
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 紙張來源的名稱。