【问题标题】:PrintPreviewControl will not switch to landscape vb.netPrintPreviewControl 不会切换到横向 vb.net
【发布时间】:2019-12-20 17:32:50
【问题描述】:

当我通过PrintPage 方法将PrintDocument 对象设置为横向时 e.PageSettings.landscape=True。如果我将它发送到打印机,它工作正常。 但是在PrintPreviewControl 上,它仍然是纵向的。我找不到直接在PrintPreviewControl 中更改页面大小或方向的方法。我尝试设置PrintDocument.DefaultPageSettings.Landscape = true,但这也无济于事。

Private Sub pDocument_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles pDocument.PrintPage

        Select Case QueryRep.ReportStyle ' only have one report style, reserved for custom reporting for each customer.

            Case 0 ' standard report format
                StandardReport(e)

        End Select

        ' isLandscape is a public variable set by the standardReport() sub
        e.PageSettings.Landscape = isLandscape

    End Sub

【问题讨论】:

  • 更多信息,如果我在设置 ppcontrol.document=pdocument 之前设置为横向,它会起作用,但如果在此之后设置它不会调整。有没有办法刷新 ppcontrol ?

标签: vb.net printing


【解决方案1】:

我能够解决这个问题。一旦打印对象链接到预览控件,您就不能更改宽度或高度或其他页面属性。该属性将更改,但打印预览控件不会响应它们。我尝试以多种不同的方式刷新控件,但没有任何效果。但是,如果您将其发送到打印机,您可以在打印过程中更改这些设置,打印机会做出响应。我的解决方法不是最好的解决方案,而是我能找到的唯一解决方案。是创建一个新的打印对象和一个新的打印预览控件,然后从中获取我需要的信息。然后销毁此控件,并配置新的打印对象,然后将其链接到预览控件。如果有人有更好的方法,请告诉我。

【讨论】:

    猜你喜欢
    • 2011-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多