PrinterSettings.PaperSources 属性

获取打印机上可用的纸张来源纸盒。

**命名空间:**System.Drawing.Printing
**程序集:**System.Drawing(在 system.drawing.dll 中)

语法

声明
Public ReadOnly Property PaperSources As PaperSourceCollection
用法
Dim instance As PrinterSettings
Dim value As PaperSourceCollection

value = instance.PaperSources
public PaperSourceCollection PaperSources { get; }
public:
property PaperSourceCollection^ PaperSources {
    PaperSourceCollection^ get ();
}
/** @property */
public PaperSourceCollection get_PaperSources ()
public function get PaperSources () : PaperSourceCollection

属性值

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

备注

PrinterSettings.PaperSourceCollection 包含 PaperSource 实例,该实例通过 PaperSource.Kind 属性(它包含 PaperSourceKind 值之一)表示纸张来源纸盒。

通常可以通过 PageSettings.PaperSource 属性将页的纸张来源设置为有效的 PaperSource(可通过 PaperSources 集合获得)。

示例

下面的代码示例用打印机支持的纸张来源填充 comboPaperSource 组合框。SourceName 被标识为向通过组合框的 DisplayMember 属性添加的项提供显示字符串的属性。该示例要求名为 printDocPrintDocument 变量和特定的组合框都已存在。

' 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
// 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.set_DisplayMember("SourceName");

PaperSource pkSource;
for (int i = 0; i < printDoc.get_PrinterSettings().get_PaperSources().
    get_Count(); i++) {
    pkSource = printDoc.get_PrinterSettings().get_PaperSources().
        get_Item(i);
    comboPaperSource.get_Items().Add(pkSource);
}

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

PrinterSettings 类
PrinterSettings 成员
System.Drawing.Printing 命名空间
PaperSource 类
PrinterSettings.PaperSourceCollection
PrinterSettings.InstalledPrinters 属性
PrinterSettings.PaperSizes 属性
PrinterResolutions
ListControl.DisplayMember