PaperSize クラス

定義

用紙のサイズを指定します。

public ref class PaperSize
public class PaperSize
[System.Serializable]
public class PaperSize
type PaperSize = class
[<System.Serializable>]
type PaperSize = class
Public Class PaperSize
継承
PaperSize
属性

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

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

注釈

このクラスは、 プロパティと PageSettings.PaperSize プロパティによってPrinterSettings.PaperSizes使用され、プリンターで使用可能な用紙サイズを取得し、ページの用紙サイズをそれぞれ設定します。

コンストラクターを PaperSize 使用して、カスタム用紙サイズを指定できます。 プロパティと Height プロパティの値はWidth、カスタム PaperSize オブジェクトに対してのみ設定できます。

印刷の詳細については、名前空間の概要に関するページを System.Drawing.Printing 参照してください。

コンストラクター

PaperSize()

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

PaperSize(String, Int32, Int32)

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

プロパティ

Height

用紙の縦幅を 1/100 インチ単位で取得または設定します。

Kind

用紙の種類を取得します。

PaperName

用紙の種類名を取得または設定します。

RawKind

PaperSize 値のいずれか、またはカスタム値を表す整数を取得または設定します。

Width

用紙の横幅を 1/100 インチ単位で取得または設定します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

PaperSize に関する情報を文字列形式で提供します。

適用対象

こちらもご覧ください