PrinterSettings.PaperSourceCollection 類別

定義

包含 PaperSource 物件的集合。

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 印表機支援的紙張來源填入下拉式方塊。 SourceName會識別為 屬性,這個屬性會提供透過下拉式方塊的 屬性新增 DisplayMember 之專案的顯示字串。 此範例要求 PrintDocument 名為 的 printDoc 變數存在,而且特定的下拉式方塊存在。

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

備註

PrinterSettings.PaperSourceCollection包含 PaperSource 實例,表示透過 PaperSource.Kind 屬性的紙張來源紙匣,其中包含其中 PaperSourceKind 一個值。

一般而言,您可以透過 PageSettings.PaperSource 屬性將頁面的紙張來源設定為集合中 PaperSources 可用的有效 PaperSource 實例。

建構函式

PrinterSettings.PaperSourceCollection(PaperSource[])

初始化 PrinterSettings.PaperSourceCollection 類別的新執行個體。

屬性

Count

取得集合中不同紙張來源的數目。

Item[Int32]

取得指定之索引處的 PaperSource

方法

Add(PaperSource)

將指定的 PaperSource 加入至 PrinterSettings.PaperSourceCollection 的結尾。

CopyTo(PaperSource[], Int32)

從指定的索引處開始,複製目前 PrinterSettings.PaperSourceCollection 的內容至指定的陣列。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetEnumerator()

傳回可逐一查看這個集合的列舉程式。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

如需這個成員的說明,請參閱 CopyTo(Array, Int32)

ICollection.Count

如需這個成員的說明,請參閱 Count

ICollection.IsSynchronized

如需這個成員的說明,請參閱 IsSynchronized

ICollection.SyncRoot

如需這個成員的說明,請參閱 SyncRoot

IEnumerable.GetEnumerator()

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

如需這個成員的說明,請參閱 GetEnumerator()

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。

AsParallel(IEnumerable)

啟用查詢的平行化作業。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

適用於

另請參閱