Printing (printpage / e.graphics)

DeltaWolf7

Well-known member
Joined
Jan 21, 2006
Messages
47
Programming Experience
Beginner
Ok, I am stuck now.

I managed to do everything i need to print but my program seems to lockup when printing multiple pages.
I started with this code.

-= PrintDocument_PrintPage Section =-
VB.NET:
[SIZE=2][COLOR=#008000]Dim g As Graphics = e.Graphics
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]Dim message As String = Nothing
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]For Each item As String In lstBox.Items
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]message = message & ControlChars.CrLf & item
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]Next
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]Dim messageFont As New Font("Arial", 10, System.Drawing.GraphicsUnit.Point)
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]g.DrawString(message, messageFont, Brushes.Black, 100, 100)
[/COLOR][/SIZE]

Can anyone tell me why this happens?

Thank you
 
you have to use the HasMorePages property of the print document to print multiple pages which means you've got to put your listbox items into a do loop so it can exit when you reach the end of the page
 
Back
Top