Resolved VS2008 Change boolean after printdocument is rendered

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
I'm using the PrintPreviewDialog and am wondering how I can change a boolean variable after the PrintDocument has been rendered in the dialog window. I found out that using the dialog's Shown event fires before the PrintDocument has been rendered so the boolean gets changed before the document's been rendered. I can't use any of the PrintDocument's events to change the boolean since the preview dialog is not always used unless there's a way I can use the EndPrint event to detect that the PrintDocument's owner is the PrintPreviewDialog or an actual printer or something.

Any suggestions?
 
e.PrintAction = (file/preview/printer),
I tested in all .Net version 2.0-4.0 and it was reliable for me, but consider the documentations remark that it's supposed not reliable PrintEventArgs.PrintAction Property (System.Drawing.Printing).
If it is not realiable for you perhaps you can use a Boolean to note if you're using preview printing?
 
Did e.PrintAction not work for you? (it is set based on PrintControllers IsPreview btw)
 
I'd gotten the working solution last night and forgot to mark both threads as resolved till this morning so I haven't tried the e.PrintAction

I also don't even have my boolean variable anymore since I'm using the IsPreview property instead which means I don't have to set my bool before showing the preview dialog and set it back after the preview has been rendered.
 
Back
Top