I've been reading reams of documentation about PrintPreviewDialog, PrintPreviewControl and PrintDocument. Everything says that I have to put the Portrait/Lanscape bit into the PrintDocument QueryPageSettings Event, then the PrintPreviewDialog will get the settings from the PrintDocument.
I started off with:
Private Sub PrintDocument1_QueryPageSettings(ByVal sender As Object, ByVal e As System.Drawing.Printing.QueryPageSettingsEventArgs) Handles PrintDocument1.QueryPageSettings
Select Case mOrientation
Case ePrinterOrientation.Landscape
PrintDocument1.DefaultPageSettings.Landscape = True
Case ePrinterOrientation.Portrait
PrintDocument1.DefaultPageSettings.Landscape = False
End Select
End Sub
Here's my current code
Private Sub PrintDocument1_QueryPageSettings(ByVal sender As Object, ByVal e As System.Drawing.Printing.QueryPageSettingsEventArgs) Handles PrintDocument1.QueryPageSettings
Select Case mOrientation
Case ePrinterOrientation.Landscape
Dim ps As New PaperSize("A4Landscape", 1169, 827)
ps.PaperName = PaperKind.A4
PrintDocument1.DefaultPageSettings.PaperSize = ps
PrintDocument1.DefaultPageSettings.Landscape = True
Case ePrinterOrientation.Portrait
Dim ps As New PaperSize("A4Portrait", 827, 1169)
ps.PaperName = PaperKind.A4
PrintDocument1.DefaultPageSettings.PaperSize = ps
PrintDocument1.DefaultPageSettings.Landscape = False
End Select
End Sub
I also tried putting this code into the PrintDocument1_BeginPrint event, this did change the "Window" of the PrintPreview, but the contents of the PrintDocument still stayed Portrait (the width of the used "view", remain the same).
The Portrait mode spans the 10 columns over 2 pages, the Landscape mode should have all the columns on 1 page, but this is not the case, the "PrintableArea" margins appear to remain exactly the same in reality, even if the numbers change to the correct values if I step through debug.
I'm getting truely p****d off with this, this 3-way dependency, it should be simpler than this.
Edit:
Further to this problem. If I PRINT the document, the orientation is set to Landscape, but the Print Margins (the Document) is still printed (with overflow) as though the margins are Portrait.
I REALLY need to fix this. It is NOT acceptable.
should be
Same goes to Portrait.