Share via


PageSettings.PrinterResolution 속성

정의

페이지에 대한 프린터 해상도를 가져오거나 설정합니다.

public:
 property System::Drawing::Printing::PrinterResolution ^ PrinterResolution { System::Drawing::Printing::PrinterResolution ^ get(); void set(System::Drawing::Printing::PrinterResolution ^ value); };
public System.Drawing.Printing.PrinterResolution PrinterResolution { get; set; }
member this.PrinterResolution : System.Drawing.Printing.PrinterResolution with get, set
Public Property PrinterResolution As PrinterResolution

속성 값

페이지의 프린터 해상도를 지정하는 PrinterResolution입니다. 기본값은 프린터의 기본 해상도입니다.

예외

PrinterName 속성에 명명된 프린터가 없거나 설치된 기본 프린터가 없는 경우

예제

다음 코드 예제에서는 콤보 상자에서 comboPrintResolution 선택한 해상도를 기반으로 하는 프린터 해상도를 포함하여 문서의 기본 페이지에 대한 세 가지 속성을 설정한 다음 메서드를 사용하여 Print 문서를 인쇄합니다. 이 예제에서는 라는 printDoc 변수가 PrintDocument 존재하고 특정 콤보 상자가 있어야 합니다.

private:
   void MyButtonPrint_Click( Object^ sender, System::EventArgs^ e )
   {
      // Set the paper size based upon the selection in the combo box.
      if ( comboPaperSize->SelectedIndex != -1 )
      {
         printDoc->DefaultPageSettings->PaperSize = printDoc->PrinterSettings->PaperSizes[ comboPaperSize->SelectedIndex ];
      }

      // Set the paper source based upon the selection in the combo box.
      if ( comboPaperSource->SelectedIndex != -1 )
      {
         printDoc->DefaultPageSettings->PaperSource = printDoc->PrinterSettings->PaperSources[ comboPaperSource->SelectedIndex ];
      }

      // Set the printer resolution based upon the selection in the combo box.
      if ( comboPrintResolution->SelectedIndex != -1 )
      {
         printDoc->DefaultPageSettings->PrinterResolution = printDoc->PrinterSettings->PrinterResolutions[ comboPrintResolution->SelectedIndex ];
      }

      // Print the document with the specified paper size, source, and print resolution.
      printDoc->Print();
   }
private void MyButtonPrint_Click(object sender, System.EventArgs e)
{
    // Set the paper size based upon the selection in the combo box.
    if (comboPaperSize.SelectedIndex != -1) {
        printDoc.DefaultPageSettings.PaperSize = 
            printDoc.PrinterSettings.PaperSizes[comboPaperSize.SelectedIndex];
    }

    // Set the paper source based upon the selection in the combo box.
    if (comboPaperSource.SelectedIndex != -1) {
        printDoc.DefaultPageSettings.PaperSource = 
            printDoc.PrinterSettings.PaperSources[comboPaperSource.SelectedIndex];
    }
    
    // Set the printer resolution based upon the selection in the combo box.
    if (comboPrintResolution.SelectedIndex != -1) 
    {
        printDoc.DefaultPageSettings.PrinterResolution= 
            printDoc.PrinterSettings.PrinterResolutions[comboPrintResolution.SelectedIndex];
    }

    // Print the document with the specified paper size, source, and print resolution.
    printDoc.Print();
}
Private Sub MyButtonPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButtonPrint.Click

    ' Set the paper size based upon the selection in the combo box.
    If comboPaperSize.SelectedIndex <> -1 Then
        printDoc.DefaultPageSettings.PaperSize = _
        printDoc.PrinterSettings.PaperSizes.Item(comboPaperSize.SelectedIndex)
    End If

    ' Set the paper source based upon the selection in the combo box.
    If comboPaperSource.SelectedIndex <> -1 Then
        printDoc.DefaultPageSettings.PaperSource = _
        printDoc.PrinterSettings.PaperSources.Item(comboPaperSource.SelectedIndex)
    End If

    ' Set the printer resolution based upon the selection in the combo box.
    If comboPrintResolution.SelectedIndex <> -1 Then
        printDoc.DefaultPageSettings.PrinterResolution = _
        printDoc.PrinterSettings.PrinterResolutions.Item(comboPrintResolution.SelectedIndex)
    End If

    ' Print the document with the specified paper size and source.
    printDoc.Print()

End Sub

설명

PrinterResolution 값 중 하나를 포함하는 속성을 통해 PrinterResolution.Kind 의 프린터 해상도를 PrinterResolutionKind 나타냅니다.

PrinterResolution 페이지의 속성을 컬렉션을 통해 PrinterSettings.PrinterResolutions 사용할 수 있는 유효한 PrinterResolution로 설정합니다.

적용 대상

추가 정보