Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
When I set the
PrintDocument
object to landscape through
PrintPage
method
e.PageSettings.landscape=True
. If I send it to the printer it works fine.
But on the
PrintPreviewControl
it remains in portrait. I can't find a way to change the page size or orientation directly in the
PrintPreviewControl
. I have tried to set
PrintDocument.DefaultPageSettings.Landscape = true
and this does not help either.
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
–
I was able to work around the issue. once the print object is linked to the preview control, you cannot change width or height or other page properties. The property will change but the print preview control will not respond to them. I tried to refresh the control many different ways and nothing worked. But if you send it to the printer you can change these settings during the print process and the printer will respond. My workaround was not the best solution but the only one i could find. Was to create a new print object and a new print preview control then get the information i needed from this. then destroy this control, and configure the new print object then link it to the preview control. If someone has a better way let me know.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.