PaperSize コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
PaperSize クラスの新しいインスタンスを初期化します。
オーバーロード
PaperSize() |
PaperSize クラスの新しいインスタンスを初期化します。 |
PaperSize(String, Int32, Int32) |
PaperSize クラスの新しいインスタンスを初期化します。 |
注釈
PaperSize クラスのインスタンスの初期プロパティ値を次の表に示します。
プロパティ | 初期値 |
---|---|
Kind | PaperKind.Custom |
PaperName | String.Empty |
PaperSize()
PaperSize(String, Int32, Int32)
PaperSize クラスの新しいインスタンスを初期化します。
public:
PaperSize(System::String ^ name, int width, int height);
public PaperSize (string name, int width, int height);
new System.Drawing.Printing.PaperSize : string * int * int -> System.Drawing.Printing.PaperSize
Public Sub New (name As String, width As Integer, height As Integer)
パラメーター
- name
- String
用紙の名前。
- width
- Int32
用紙の横幅 (1/100 インチ単位)。
- height
- Int32
用紙の縦幅 (1/100 インチ単位)。
例
次のコード例では、コンボ ボックスに 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)
注釈
PaperSizeこのコンストラクターを使用して作成されたコンストラクターのプロパティはKind常に ..Custom プロパティ値とプロパティHeight値はWidth、カスタム PaperSize オブジェクトに対してのみ設定できます。