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.PaperSourceCollectionPaperSource通过 PaperSource.Kind 属性表示纸张源纸盒的实例,该属性包含值之PaperSourceKind一。

通常,通过 PageSettings.PaperSource 属性将页面的纸张源设置为通过PaperSources集合提供的有效PaperSource源。

适用于

另请参阅