PrinterSettings.PaperSourceCollection 类

定义

包含 PaperSource 对象的集合。Contains a collection of PaperSource objects.

public: ref class PrinterSettings::PaperSourceCollection : System::Collections::ICollection
public class PrinterSettings.PaperSourceCollection : System.Collections.ICollection
type PrinterSettings.PaperSourceCollection = class
    interface ICollection
    interface IEnumerable
Public Class PrinterSettings.PaperSourceCollection
Implements ICollection
继承
PrinterSettings.PaperSourceCollection
实现

示例

下面的代码示例用打印机comboPaperSource支持的纸张来源填充组合框。The following code example populates the comboPaperSource combo box with the printer's supported paper sources. 标识为属性, 该属性为通过组合框的DisplayMember属性添加的项提供显示字符串。 SourceNameThe 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

注解

包含通过属性 (包含PaperSourceKind值之一) 表示纸张来源托盘的实例。 PaperSource.Kind PaperSource PrinterSettings.PaperSourceCollectionThe PrinterSettings.PaperSourceCollection contains PaperSource instances that represents the paper source trays through the PaperSource.Kind property, which contains one of the PaperSourceKind values.

通常情况下, 可通过该PageSettings.PaperSource属性将页面的纸张来源设置为通过PaperSources集合提供的有效PaperSource实例。Typically, you set a page's paper source through the PageSettings.PaperSource property to a valid PaperSource instance available through the PaperSources collection.

构造函数

PrinterSettings.PaperSourceCollection(PaperSource[])

初始化 PrinterSettings.PaperSourceCollection 类的新实例。Initializes a new instance of the PrinterSettings.PaperSourceCollection class.

属性

Count

获取集合中不同纸张来源的数目。Gets the number of different paper sources in the collection.

Item[Int32]

获取指定索引处的 PaperSourceGets the PaperSource at a specified index.

方法

Add(PaperSource)

将指定的 PaperSource 添加到 PrinterSettings.PaperSourceCollection 的末尾。Adds the specified PaperSource to end of the PrinterSettings.PaperSourceCollection.

CopyTo(PaperSource[], Int32)

将当前 PrinterSettings.PaperSourceCollection 的内容复制到指定数组,从指定索引处开始。Copies the contents of the current PrinterSettings.PaperSourceCollection to the specified array, starting at the specified index.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEnumerator()

返回可循环访问集合的枚举数。Returns an enumerator that can iterate through the collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

ICollection.CopyTo(Array, Int32)

有关此成员的说明,请参见 CopyTo(Array, Int32)For a description of this member, see CopyTo(Array, Int32).

ICollection.Count

有关此成员的说明,请参见 CountFor a description of this member, see Count.

ICollection.IsSynchronized

有关此成员的说明,请参见 IsSynchronizedFor a description of this member, see IsSynchronized.

ICollection.SyncRoot

有关此成员的说明,请参见 SyncRootFor a description of this member, see SyncRoot.

IEnumerable.GetEnumerator()

有关此成员的说明,请参见 GetEnumerator()For a description of this member, see GetEnumerator().

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅