PageRangeSelection 列舉

定義

指定作業 (通常是列印作業) 是要處理所有頁面還是僅處理有限的頁面範圍。Specifies whether all the pages or only a limited range will be processed by an operation, usually printing.

public enum class PageRangeSelection
public enum PageRangeSelection
type PageRangeSelection = 
Public Enum PageRangeSelection
繼承
PageRangeSelection

欄位

AllPages 0

所有頁面。All pages.

CurrentPage 2

目前的頁面。The current page.

SelectedPages 3

選取的頁面。The selected pages.

UserPages 1

使用者指定的頁面範圍。A user-specified range of pages.

範例

下列範例示範如何使用列舉,透過 PageRangeSelection 和程式碼來設定屬性 Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)The following example shows how to use the enumeration to set the PageRangeSelection property by using Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) and code.

<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

備註

這個列舉主要是用來做為 PrintDialog 的 PageRangeSelection 屬性值。 PrintDialogThis enumeration is primarily used as the value of the PageRangeSelection property of the PrintDialog.

適用於