PageSettings.PrinterResolution Özellik

Tanım

Sayfanın yazıcı çözünürlüğünü alır veya ayarlar.

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

Özellik Değeri

PrinterResolution Sayfanın yazıcı çözünürlüğünü belirten bir. Varsayılan, yazıcının varsayılan çözünürlüğüdür.

Özel durumlar

özelliğinde PrinterName adlı yazıcı yok veya yüklü varsayılan yazıcı yok.

Örnekler

Aşağıdaki kod örneği, birleşik giriş kutusunda seçilen comboPrintResolution çözünürlüğe göre yazıcının çözünürlüğü de dahil olmak üzere belgenin varsayılan sayfası için üç özellik ayarlar ve ardından yöntemini kullanarak belgeyi Print yazdırır. Örnek, adlı printDoc bir PrintDocument değişkenin mevcut olmasını ve belirli birleşik giriş kutularının mevcut olmasını gerektirir.

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

Açıklamalar

A PrinterResolution , değerini içeren özelliği aracılığıyla PrinterResolution.Kind yazıcı çözünürlüğünü PrinterResolutionKind temsil eder.

PrinterResolution Sayfanın özelliğini, koleksiyon aracılığıyla PrinterSettings.PrinterResolutions kullanılabilen geçerli PrinterResolutionbir olarak ayarlayın.

Şunlara uygulanır

Ayrıca bkz.