PaperSize 생성자

정의

PaperSize 클래스의 새 인스턴스를 초기화합니다.

오버로드

PaperSize()

PaperSize 클래스의 새 인스턴스를 초기화합니다.

PaperSize(String, Int32, Int32)

PaperSize 클래스의 새 인스턴스를 초기화합니다.

설명

다음 표에서는 PaperSize 클래스의 인스턴스에 대한 초기 속성 값을 보여 줍니다.

속성 초기 값
Kind PaperKind.Custom
PaperName String.Empty

PaperSize()

Source:
PaperSize.cs
Source:
PaperSize.cs
Source:
PaperSize.cs

PaperSize 클래스의 새 인스턴스를 초기화합니다.

public:
 PaperSize();
public PaperSize ();
Public Sub New ()

적용 대상

PaperSize(String, Int32, Int32)

Source:
PaperSize.cs
Source:
PaperSize.cs
Source:
PaperSize.cs

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 제공하는 속성으로 식별됩니다. 이 예제에서는 라는 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)

설명

PaperSize 이 생성자를 사용하여 만든 에는 항상 해당 속성이 Kind 로 설정됩니다Custom. 및 Height 속성 값은 Width 사용자 지정 PaperSize 개체에 대해서만 설정할 수 있습니다.

적용 대상