PrintPreviewControl将不会切换到横向vb.net
当我通过PrintPreviewControl将不会切换到横向vb.net,vb.net,printing,Vb.net,Printing,当我通过PrintPage方法将PrintDocument对象设置为横向时 e.PageSettings.landscape=True。如果我把它送到打印机上,它可以正常工作。 但是在PrintPreviewControl上,它仍然是纵向的。我找不到直接在PrintPreviewControl中更改页面大小或方向的方法。我已尝试设置PrintDocument.DefaultPageSettings.Landscape=true,但这也没有帮助 Private Sub pDocument_Prin
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之前设置为横向,它会工作,但如果在此之后设置,它将不会调整。是否有方法刷新PPC控件?