PrinterSettings.PaperSizes 속성

정의

이 프린터에서 지원하는 용지 크기를 가져옵니다.

public:
 property System::Drawing::Printing::PrinterSettings::PaperSizeCollection ^ PaperSizes { System::Drawing::Printing::PrinterSettings::PaperSizeCollection ^ get(); };
public System.Drawing.Printing.PrinterSettings.PaperSizeCollection PaperSizes { get; }
member this.PaperSizes : System.Drawing.Printing.PrinterSettings.PaperSizeCollection
Public ReadOnly Property PaperSizes As PrinterSettings.PaperSizeCollection

속성 값

이 프린터에서 지원하는 용지 크기를 나타내는 PrinterSettings.PaperSizeCollection입니다.

예제

다음 코드 예제에서는 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)

설명

PrinterSettings.PaperSizeCollection 에는 PaperSize 값 중 하나를 포함하는 속성을 통해 PaperSize.Kind 용지 크기를 나타내는 인스턴스가 PaperKind 포함됩니다.

일반적으로 를 통해 페이지의 용지 크기를 설정 합니다 PageSettings.PaperSize 속성을 통해 사용할 수 있는 PaperSizes 유효한 PaperSize 컬렉션입니다.

사용자 지정 용지 크기를 지정하려면 생성자를 PaperSize 참조하세요.

적용 대상

추가 정보