共用方式為


PrinterSettings.PaperSources 屬性

定義

取得印表機可用的紙張來源紙匣。

public:
 property System::Drawing::Printing::PrinterSettings::PaperSourceCollection ^ PaperSources { System::Drawing::Printing::PrinterSettings::PaperSourceCollection ^ get(); };
public System.Drawing.Printing.PrinterSettings.PaperSourceCollection PaperSources { get; }
member this.PaperSources : System.Drawing.Printing.PrinterSettings.PaperSourceCollection
Public ReadOnly Property PaperSources As PrinterSettings.PaperSourceCollection

屬性值

PrinterSettings.PaperSourceCollection,表示印表機可用的紙張來源紙匣。

範例

下列程式代碼範例會將 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

備註

PrinterSettings.PaperSourceCollection包含PaperSource實例,表示透過 PaperSource.Kind 屬性的紙張來源紙匣,其中包含其中PaperSourceKind一個值。

一般而言,您會透過 PageSettings.PaperSource 屬性將頁面的紙張來源設定為可透過PaperSources集合取得的有效PaperSource

適用於

另請參閱