PaperSource.SourceName 属性

定义

获取或设置纸张来源的名称。Gets or sets the name of the paper source.

public:
 property System::String ^ SourceName { System::String ^ get(); void set(System::String ^ value); };
public:
 property System::String ^ SourceName { System::String ^ get(); };
public string SourceName { get; set; }
public string SourceName { get; }
member this.SourceName : string with get, set
member this.SourceName : string
Public Property SourceName As String
Public ReadOnly Property SourceName As String

属性值

String

纸张来源的名称。The name of the paper source.

示例

下面的代码示例 comboPaperSource 用打印机支持的纸张来源填充组合框。The following code example populates the comboPaperSource combo box with the printer's supported paper sources. SourceName标识为属性,该属性为通过组合框的属性添加的项提供显示字符串 DisplayMemberThe SourceName is identified as the property that provides the display string for the item being added through the DisplayMember property of the combo box. 该示例要求 PrintDocument 名为的变量 printDoc 存在并且存在特定的组合框。The example requires that a PrintDocument variable named printDoc exists and that the specific combo box exists.

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

注解

需要显示纸张来源时,请调用此属性。Call this property when the paper source needs to be displayed. 根据属性生成的纸张来源的名称 KindThe name of the paper source is generated based upon the Kind property.

适用于

另请参阅