|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Printdocument.PrintPage cancel current printpageHi, can anyone tell me how to cancel the printing of the current page while
in the Printdocument.PrintPage event. I don't want to cancel the whole printjob! I need this for printing only the user defined selected pages or the from/to pages. Coen The PrintPageEventArgs object's graphics object has a Clear. I believe that
just clears the current page. I've never tried this so you'll have to experiment a bit. You might be able to just clear the page and return and ..Net will skip the page. More likely, though, you'll have to go on to your next page routine without exitting that routine. For your needs, though, I think it might be better to have a common routine called for all pages. The routine would keep track of what pages have and haven't printed and call the print routines for your pages. Something like this.... Sub PagePrint(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) mnPage += 1 'higher level variable set to 0 at the start of job by another routine if UserWantsThisPage(mnPage) then select case mnPage case 1: PrintCoverPage case 2,3,4: PrintOneOfThesePages case 5: PrintLastPage end select end if end sub Show quoteHide quote "Coen" wrote: > Hi, can anyone tell me how to cancel the printing of the current page while > in the Printdocument.PrintPage event. I don't want to cancel the whole > printjob! > I need this for printing only the user defined selected pages or the from/to > pages. > > Coen Did you try e.HasMorePages = False ?
A lot of printpage event handlers use more than one logic point to set this. You can then 'return' from a midpoint in the printpage handler. Coen wrote: Show quoteHide quote >Hi, can anyone tell me how to cancel the printing of the current page while >in the Printdocument.PrintPage event. I don't want to cancel the whole >printjob! >I need this for printing only the user defined selected pages or the from/to >pages. > >Coen |
|||||||||||||||||||||||