PaperSource 类

指定给打印机送纸的纸盒。

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

语法

声明
<SerializableAttribute> _
Public Class PaperSource
用法
Dim instance As PaperSource
[SerializableAttribute] 
public class PaperSource
[SerializableAttribute] 
public ref class PaperSource
/** @attribute SerializableAttribute() */ 
public class PaperSource
SerializableAttribute 
public class PaperSource

备注

此类由 PrinterSettings.PaperSourcesPageSettings.PaperSource 属性用来获取打印机上可用的纸张来源纸盒并分别为页设置纸张来源。

有关打印的更多信息,请参见 System.Drawing.Printing 命名空间概述。

示例

下面的代码示例用打印机支持的纸张来源填充 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);
}

继承层次结构

System.Object
  System.Drawing.Printing.PaperSource

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

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

请参见

参考

PaperSource 成员
System.Drawing.Printing 命名空间
PaperSourceKind
PrinterSettings
PrinterSettings.PaperSources
PageSettings.PaperSource 属性
ListControl.DisplayMember