none
DocumentViewer控件怎么设置按单页显示 RRS feed

  • 问题

  • DocumentViewer控件的工具条上有一个单页的按钮(快捷键Ctrl+3)可以单页显示??
    可是在后台代码怎么设置呢?

     

    DocumentViewer XPSPlayer = new DocumentViewer();   XPSPlayer.Width = 500;  XPSPlayer.Height = 500;        XPSPlayer.Zoom = 100;  using (XpsDocument xpsDoc = new XpsDocument(xpsFilePath, FileAccess.Read)) {                            var fs = xpsDoc.GetFixedDocumentSequence();                           

    XPSPlayer.Document = fs;                            XPSPlayer.FirstPage(); } this.Children.Add(XPSPlayer);



    2013年12月12日 2:27

答案

  • 你好,

    你可以使用DocumentViewer.FitToMaxPagesAcross 方法或者 DocumentViewer.FitToMaxPagesAcrossCommand 属性:

    using (XpsDocument xpsDoc = new XpsDocument(@"E:\Desktop\test.xps", FileAccess.Read))
    {
                    var fs = xpsDoc.GetFixedDocumentSequence();
    
                    XPSPlayer.Document = fs;
                    XPSPlayer.FitToMaxPagesAcross(1);
                    XPSPlayer.FirstPage();
    }

    或者

    using (XpsDocument xpsDoc = new XpsDocument(@"E:\Desktop\test.xps", FileAccess.Read))
    {
                    var fs = xpsDoc.GetFixedDocumentSequence();
    
                    XPSPlayer.Document = fs;
                    DocumentViewer.FitToMaxPagesAcrossCommand.Execute("1", XPSPlayer);
                    XPSPlayer.FirstPage();
    }

    Screenshot:


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 heller灬 2013年12月17日 2:30
    2013年12月13日 4:58
    版主

全部回复

  • 你好,

    你可以使用DocumentViewer.FitToMaxPagesAcross 方法或者 DocumentViewer.FitToMaxPagesAcrossCommand 属性:

    using (XpsDocument xpsDoc = new XpsDocument(@"E:\Desktop\test.xps", FileAccess.Read))
    {
                    var fs = xpsDoc.GetFixedDocumentSequence();
    
                    XPSPlayer.Document = fs;
                    XPSPlayer.FitToMaxPagesAcross(1);
                    XPSPlayer.FirstPage();
    }

    或者

    using (XpsDocument xpsDoc = new XpsDocument(@"E:\Desktop\test.xps", FileAccess.Read))
    {
                    var fs = xpsDoc.GetFixedDocumentSequence();
    
                    XPSPlayer.Document = fs;
                    DocumentViewer.FitToMaxPagesAcrossCommand.Execute("1", XPSPlayer);
                    XPSPlayer.FirstPage();
    }

    Screenshot:


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 heller灬 2013年12月17日 2:30
    2013年12月13日 4:58
    版主
  • 你好,按照你的方法可以设置宽度为单页,但是有时候高度不是单页???

    怎么解决这个问题?

    2014年1月14日 5:52
  • 你好,对于这个新问题,请发新帖,方便我们交流。

    感谢理解:)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年1月15日 1:17
    版主