PrintDialog 클래스

정의

사용자 입력에 따라 PrintTicketPrintQueue를 구성한 다음 문서를 인쇄하는 표준 Microsoft Windows 인쇄 대화 상자를 호출합니다.

public ref class PrintDialog
public class PrintDialog
type PrintDialog = class
Public Class PrintDialog
상속
PrintDialog

예제

다음 예제에서는 XAML(Extensible Application Markup Language) 태그 및 코드를 사용하여 인스턴스를 만들고 간단한 PrintDialog 인스턴스를 표시하는 방법을 보여 줍니다.

<Button Width="200" Click="InvokePrint">Invoke PrintDialog</Button>

...

private void InvokePrint(object sender, RoutedEventArgs e)
    {
        // Create the print dialog object and set options
        PrintDialog pDialog = new PrintDialog();
        pDialog.PageRangeSelection = PageRangeSelection.AllPages;
        pDialog.UserPageRangeEnabled = true;

        // Display the dialog. This returns true if the user presses the Print button.
        Nullable<Boolean> print = pDialog.ShowDialog();
        if (print == true)
        {
            XpsDocument xpsDocument = new XpsDocument("C:\\FixedDocumentSequence.xps", FileAccess.ReadWrite);
            FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();
            pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print job");
        }
    }
Private Sub InvokePrint(ByVal sender As Object, ByVal e As RoutedEventArgs)
        ' Create the print dialog object and set options
        Dim pDialog As New PrintDialog()
        pDialog.PageRangeSelection = PageRangeSelection.AllPages
        pDialog.UserPageRangeEnabled = True

        ' Display the dialog. This returns true if the user presses the Print button.
        Dim print? As Boolean = pDialog.ShowDialog()
        If print = True Then
            Dim xpsDocument As New XpsDocument("C:\FixedDocumentSequence.xps", FileAccess.ReadWrite)
            Dim fixedDocSeq As FixedDocumentSequence = xpsDocument.GetFixedDocumentSequence()
            pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print job")
        End If
End Sub

설명

사용자는 인쇄 대화 상자를 사용하여 프린터를 선택하고, 구성하고, 인쇄 작업을 수행할 수 있습니다.

엄밀히 말하면 대화 상자를 열지 않고도 메서드를 사용할 PrintDocument 수 있습니다. 그런 의미에서 컨트롤을 보이지 않는 인쇄 구성 요소로 사용할 수 있습니다. 그러나 성능상의 이유로 메서드 또는 많은 메서드와 WriteAsync 메서드 XpsDocumentWriterWrite 하나를 사용하는 AddJob 것이 좋습니다. 이에 대한 자세한 내용은 방법: 프로그래밍 방식으로 XPS 파일 인쇄를 참조하세요.

이 클래스System.Windows.Controls.PrintDialogSystem.Windows.Forms.PrintDialog를 혼동하지 마세요. 후자는 Windows Forms 애플리케이션을 사용 하 여 사용 됩니다. System.Windows.Controls.PrintDialog Windows Presentation Foundation 애플리케이션에 사용 됩니다.

생성자

PrintDialog()

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

속성

CurrentPageEnabled

현재 페이지를 인쇄하는 옵션이 사용되는지 여부를 나타내는 값을 가져오거나 설정합니다.

MaxPage

페이지 범위에 허용되는 최대 페이지 번호를 가져오거나 설정합니다.

MinPage

페이지 범위에 허용되는 최소 페이지 번호를 가져오거나 설정합니다.

PageRange

PageRangeSelectionUserPages로 설정된 경우 페이지 범위를 가져오거나 설정합니다.

PageRangeSelection

PageRangeSelection의 이 인스턴스에 대한 PrintDialog을 가져오거나 설정합니다.

PrintableAreaHeight

페이지에서 인쇄할 수 있는 영역의 높이를 가져옵니다.

PrintableAreaWidth

페이지에서 인쇄할 수 있는 영역의 너비를 가져옵니다.

PrintQueue

선택된 프린터를 나타내는 PrintQueue를 가져오거나 설정합니다.

PrintTicket

현재 인쇄 작업에 대해 인쇄 를 클릭할 때 PrintTicket에서 사용되는 PrintDialog을 가져오거나 설정합니다.

SelectedPagesEnabled

선택한 페이지를 인쇄하는 옵션이 사용되는지 여부를 나타내는 값을 가져오거나 설정합니다.

UserPageRangeEnabled

인쇄 대화 상자에서 인쇄할 페이지 범위를 지정할 수 있는 옵션이 제공되는지 여부를 나타내는 값을 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
PrintDocument(DocumentPaginator, String)

DocumentPaginator 개체를 현재 선택된 PrintQueue에 인쇄합니다.

PrintVisual(Visual, String)

Visual 클래스에서 파생된 텍스트가 아닌 비주얼 개체를 현재 선택된 PrintQueue에 인쇄합니다.

ShowDialog()

PrintDialog를 모달 대화 상자로 호출합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상