Share via


PrintDocument 类

定义

定义一个可重用对象,该对象将输出发送到打印机。

/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PrintDocument : DependencyObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class PrintDocument : DependencyObject
Public Class PrintDocument
Inherits DependencyObject
继承
Object IInspectable DependencyObject PrintDocument
属性

注解

PrintDocument 实现了打印列表概念,通过该概念可以将页面添加到打印列表,然后可以在正在进行的打印列表中调用各种方法。

构造函数

PrintDocument()

初始化 PrintDocument 类的新实例。

属性

Dispatcher

始终在Windows 应用 SDK应用中返回 null 。 请改用 DispatcherQueue

(继承自 DependencyObject)
DispatcherQueue

DispatcherQueue获取与此对象关联的 。 表示 DispatcherQueue 一个可以在 UI 线程上访问 DependencyObject 的设施,即使代码是由非 UI 线程启动的。

(继承自 DependencyObject)
DocumentSource

获取此 PrintDocument 的文档源引用。

DocumentSourceProperty

标识 DocumentSource 依赖属性。

方法

AddPage(UIElement)

将 XAML 根视觉对象元素添加到打印列表。

AddPagesComplete()

指示应用程序不会向打印列表添加更多页,并且打印列表已准备好发布。

ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
GetAnimationBaseValue(DependencyProperty)

返回为依赖属性建立的任何基值,该基值适用于动画未处于活动状态的情况。

(继承自 DependencyObject)
GetValue(DependencyProperty)

DependencyObject 返回依赖属性的当前有效值。

(继承自 DependencyObject)
InvalidatePreview()

引用低级别打印预览对话框 API 并使当前打印预览无效。

ReadLocalValue(DependencyProperty)

如果设置了本地值,则返回依赖属性的本地值。

(继承自 DependencyObject)
RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

注册通知函数,用于侦听此 DependencyObject 实例上对特定 DependencyProperty 的更改。

(继承自 DependencyObject)
SetPreviewPage(Int32, UIElement)

将指定的打印页设置为当前打印预览页。

SetPreviewPageCount(Int32, PreviewPageCountType)

设置为打印预览准备并添加到打印列表的页数。

SetValue(DependencyProperty, Object)

设置 DependencyObject 上依赖属性的本地值。

(继承自 DependencyObject)
UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消以前通过调用 RegisterPropertyChangedCallback 注册的更改通知。

(继承自 DependencyObject)

事件

AddPages

PrintManager 请求将页面的最终集合发送到打印机时发生。

GetPreviewPage

PrintManager 请求在预览窗口中显示特定打印页时发生。

Paginate

PrintManager 请求打印页集合显示在预览窗口中时发生。

适用于

另请参阅