首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在wpf / c#中混合横向和纵向打印

在wpf / c#中混合横向和纵向打印
EN

Stack Overflow用户
提问于 2011-10-17 00:38:39
回答 1查看 2K关注 0票数 2

在一个WPF / C#应用程序中,我使用DocumentPaginator打印一些页面。但是,我想在横向和纵向模式下混合1个打印作业页面:例如,纵向模式中的第1页,横向模式中的第2页和纵向模式中的第3页。

但是,如果我更改PageSize (从DocumentPaginator覆盖)以反映景观,则页面仍处于纵向模式。

换句话说,在

代码语言:javascript
复制
public class PrintPaginator : DocumentPaginator
    {
        public override Size PageSize { get; set; }
        public override DocumentPage GetPage(int pageNumber)
        {
            // size values
            Size theSizeOfThePage;
            // make size orientation correct
            if (pageNumber == 2)
            {
                // landscape: width is larger then height
                theSizeOfThePage = new Size(Math.Max(PageSize.Width, PageSize.Height), Math.Min(PageSize.Width, PageSize.Height));
            }
            else
            {
                // portrait: height is larger then width
                theSizeOfThePage = new Size(Math.Min(PageSize.Width, PageSize.Height), Math.Max(PageSize.Width, PageSize.Height));
            }
            PageSize = theSizeOfThePage;

            // set the grid as the page to print
            thePage = new Grid();
            thePage.Width = PageSize.Width;
            thePage.Height = PageSize.Height;

            [...]

            // return a documentpage wrapping the grid
            return new DocumentPage(thePage);
        }

我相信我不能设置方向或PageSize的景观,因为这取决于正在打印的页码…

有什么想法,建议,工作坊可以在一次打印中混合肖像和风景吗?

谢谢!R.

EN

回答 1

Stack Overflow用户

发布于 2012-07-25 19:03:44

我知道您已经问了很长时间了,但是您是否尝试过在新DocumentPage()调用的构造函数中直接设置PageSize?

更多详情请访问我的博客:http://wieser-software.blogspot.co.uk/2012/07/landscape-printing-and-preview-in-wpf.html

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7785715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档