PrinterSettings.PaperSizeCollection クラス

定義

PaperSize オブジェクトのコレクションを含んでいます。

public: ref class PrinterSettings::PaperSizeCollection : System::Collections::ICollection
public class PrinterSettings.PaperSizeCollection : System.Collections.ICollection
type PrinterSettings.PaperSizeCollection = class
    interface ICollection
    interface IEnumerable
Public Class PrinterSettings.PaperSizeCollection
Implements ICollection
継承
PrinterSettings.PaperSizeCollection
実装

次のコード例では、コンボ ボックスに comboPaperSize プリンターでサポートされている用紙サイズを設定します。 さらに、カスタム用紙サイズが作成され、コンボ ボックスに追加されます。 コンボ PaperName ボックスのプロパティを使用して DisplayMember 追加される項目の表示文字列を提供するプロパティとして識別されます。 この例では、名前付 PrintDocument きの printDoc 変数が存在し、特定のコンボ ボックスが存在する必要があります。

// Add list of supported paper sizes found on the printer.
// The DisplayMember property is used to identify the property that will provide the display String*.
comboPaperSize->DisplayMember = "PaperName";
PaperSize^ pkSize;
for ( int i = 0; i < printDoc->PrinterSettings->PaperSizes->Count; i++ )
{
   pkSize = printDoc->PrinterSettings->PaperSizes[ i ];
   comboPaperSize->Items->Add( pkSize );
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize^ pkCustomSize1 = gcnew PaperSize( "First custom size",100,200 );
comboPaperSize->Items->Add( pkCustomSize1 );
// Add list of supported paper sizes found on the printer. 
// The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName";

PaperSize pkSize;
for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
    pkSize = printDoc.PrinterSettings.PaperSizes[i];
    comboPaperSize.Items.Add(pkSize);
}

// Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

comboPaperSize.Items.Add(pkCustomSize1);
' Add list of supported paper sizes found on the printer. 
' The DisplayMember property is used to identify the property that will provide the display string.
comboPaperSize.DisplayMember = "PaperName"

Dim pkSize As PaperSize
For i = 0 to printDoc.PrinterSettings.PaperSizes.Count - 1
    pkSize = printDoc.PrinterSettings.PaperSizes.Item(i)
    comboPaperSize.Items.Add(pkSize)
Next

' Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 100, 200)

comboPaperSize.Items.Add(pkCustomSize1)

注釈

プロパティ PrinterSettings.PaperSizeCollectionPaperSize 用紙サイズ PaperSize.Kind を表すインスタンスが含まれています。このインスタンスには、値の PaperKind 1 つが含まれます。

通常は、プロパティを通じてページの用紙サイズを PageSettings.PaperSize 、コレクションで使用できる有効な PaperSize インスタンスに PaperSizes 設定します。

カスタム用紙サイズを PaperSize 指定する方法については、コンストラクターを参照してください。

コンストラクター

PrinterSettings.PaperSizeCollection(PaperSize[])

PrinterSettings.PaperSizeCollection クラスの新しいインスタンスを初期化します。

プロパティ

Count

コレクション内の異なる用紙サイズの数を取得します。

Item[Int32]

指定したインデックスにある PaperSize を取得します。

メソッド

Add(PaperSize)

PrinterResolution をコレクションの末尾に追加します。

CopyTo(PaperSize[], Int32)

指定したインデックスを開始位置として、指定した配列に現在の PrinterSettings.PaperSizeCollection の内容をコピーします。

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()

このメンバーの詳細については、「GetEnumerator()」をご覧ください。

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象

こちらもご覧ください