英語で読む

次の方法で共有


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提供する プロパティとして識別されます。 この例では、 という名前printDocPrintDocument変数が存在し、特定のコンボ ボックスが存在することを前提としています。

// 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 に関する情報を文字列形式で提供します。

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください