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

PrinterSettings.PaperSourceCollection,表示此台打印机上可用的纸张来源纸盒。

示例

下面的代码示例使用打印机支持的纸张源填充 comboPaperSource 组合框。 标识 SourceName 为为通过 DisplayMember 组合框的属性添加的项提供显示字符串的属性。 该示例要求存在一printDoc个名为PrintDocument的变量,并且存在特定的组合框。

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

适用于

另请参阅