PageRangeSelection 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定作業 (通常是列印作業) 是要處理所有頁面還是僅處理有限的頁面範圍。
public enum class PageRangeSelection
C#
public enum PageRangeSelection
type PageRangeSelection =
Public Enum PageRangeSelection
- 繼承
名稱 | 值 | Description |
---|---|---|
AllPages | 0 | 所有頁面。 |
CurrentPage | 2 | 目前的頁面。 |
SelectedPages | 3 | 選取的頁面。 |
UserPages | 1 | 使用者指定的頁面範圍。 |
下列範例示範如何使用 列舉,使用 Extensible Application Markup Language (XAML) 和程式碼來設定 PageRangeSelection 屬性。
XAML
<Button Width="200" Click="InvokePrint">Invoke PrintDialog</Button>
...
C#
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
這個列舉主要用來做為 PageRangeSelectionPrintDialog的 屬性值。
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |