Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Printing Landscape

0 views
Skip to first unread message

Scott Abbott

unread,
Dec 11, 2003, 10:19:46 AM12/11/03
to
I have this print function that I use to print my text
file. When this prints it uses the original printer
settings to print the first page and then all subsequent
pages follow the way I have this layed out. What am I
missing that the first page will not print the layout that
I'm asking for?

Here is my sub...

Private Sub PrintDocument1_PrintPage(ByVal sender As
System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage

Dim PD As New Printing.PrintDocument()
Dim PageDoc As Printing.PageSettings = New
Printing.PageSettings()
Dim ppdlg As PrintPreviewDialog = New
PrintPreviewDialog()
Dim psdlg As PageSetupDialog = New PageSetupDialog
()
Dim i As Integer
Dim j As Integer
Dim s As String
Dim hline As Long
Dim linesperpage As Single = 0
Dim mfnt As Font = New Font("Courier New", 10,
FontStyle.Bold, GraphicsUnit.Point)
Dim mfnt2 As Font = New Font("Courier New", 10,
FontStyle.Regular, GraphicsUnit.Point)

Dim LineHeight As Single = mfnt.GetHeight
(e.Graphics)
Dim LineHeight2 As Single = mfnt2.GetHeight
(e.Graphics)

'*****************


psdlg.Document = PD
PD.DefaultPageSettings.Landscape = False
e.PageSettings.Landscape = False
e.HasMorePages = False
psdlg.PageSettings.Landscape = False
psdlg.Reset()
PageDoc.Landscape = False


'PrintDocument1.PrinterSettings.LandscapeAngle = 0
'**********************

j = 0
For i = 0 To vList1.Items.Count - 1
s = VB6.GetItemString(vList1, i)
If VB.Left(VB6.GetItemString(vList1, i), 2)
= "*B" Then
j = 1
Else
If VB.Left(VB6.GetItemString(vList1, i),
2) = "-B" Then
j = 0
End If
End If

If VB.Left(VB6.GetItemString(vList1, i), 2)
= "*B" Or VB.Left(VB6.GetItemString(vList1, i), 2) = "-B"
Or VB.Left(VB6.GetItemString(vList1, i), 2) = "*P" Then
If VB.Left(VB6.GetItemString(vList1, i),
2) = "*P" Then
' Need to put in advance to new page
here '
End If
Else
If j = 1 Then
hline += LineHeight
e.PageSettings.Landscape = False
e.Graphics.DrawString(s, mfnt,
Brushes.Black, 1, hline)
Else
hline += LineHeight2
e.PageSettings.Landscape = False
e.Graphics.DrawString(s, mfnt2,
Brushes.Black, 1, hline)
End If
End If

Next i
Exit Sub
ErrHandler:
Exit Sub
End Sub

John Hornick [MSFT]

unread,
Dec 11, 2003, 7:25:02 PM12/11/03
to
Hi,

You need to make your changes prior to the time your PrintPage event
handler is called. Once it's been called, the page is already started.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.

0 new messages