打印多页在WPF多页、WPF

2023-09-03 23:34:38 作者:专注学渣12年

我要印我的形式,但它是大的只有一个页面输入,所以我需要在2页打印,我可怜的知识,让我知道如何打印一页,但热点如何在多页打印。 你有什么建议我怎么能在多打印,所有形式的帮助将是AP preciate。

i have to print my form but it is big to enter in only one page so i need to print it in 2 pages ,my poor knowledge allow me to know how print one page but hot how print in multipage . Do you have any advice how i can print in multipage,all kind of help will be appreciate.

感谢。

好工作

推荐答案

您需要重写的 DocumentPaginator 类。

这博客帖子帮我弄它的工作。

我所做的就是创建一个用户控件,将显示一个数据页的(任何页面)的价值。

What I did was create a UserControl that would show one page's (any of the pages) worth of data.

然后在覆盖了 GetPage中我创建了用户控件(传递给它的页码来渲染),然后测量并安排它(使用每页 DocumentPaginator ),并返回它作为一个 DocumentPage (将它传递给的构造函数 DocumentPage )。

Then in the override for GetPage I created the UserControl (passing it the page number to render), then measured and arranged it (using the PageSize from the DocumentPaginator), and returned it as a DocumentPage (by passing it to the constructor of DocumentPage).

然后,你需要重写 PageCount 每页,这样当每页更新时, PageCount 被改变。

Then you need to override PageCount and PageSize, so that when PageSize is updated, the PageCount is changed.