PaperSource.SourceName 属性

获取或设置纸张来源的名称。

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

语法

声明
Public Property SourceName As String
用法
Dim instance As PaperSource
Dim value As String

value = instance.SourceName

instance.SourceName = value
public string SourceName { get; set; }
public:
property String^ SourceName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_SourceName ()

/** @property */
public void set_SourceName (String value)
public function get SourceName () : String

public function set SourceName (value : String)

属性值

纸张来源的名称。

备注

需要显示纸张来源时调用此属性。纸张来源的名称是基于 Kind 属性生成的。

示例

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

请参见

参考

PaperSource 类
PaperSource 成员
System.Drawing.Printing 命名空间
PaperSourceKind