ALX
Well-known member
My app uses the standard "Print Preview" to display what "PrintDocument1" looks like prior to the actual printing task. In the PrintDocument1.PrintPage event handler, some checks are done to insure that the printed image will actually fit on the page. If the user has set the margins in a manner that would prevent the image from printing correctly, then an error message is displayed after which the following statements are involked:
e.HasMorePages = False
e.Cancel = True
Exit Sub
Now when the user returns to the printer set up process and makes corrections to the bogus margin settings, and goes to print again, the process completely skips PrintDocument1.PrintPage event handler and displays a blank page. The 3rd time the user goes through this process, everything works OK (provided the user has set some realistic margins). I'm thinking the "e.Cancel" or the "e.HasMorePages" statement has flipped the process some how. I don't want to dispose and recreate the PrintPreview class every time the user goes to print because of other overhead involved. I'm wondering if there's a property or method that I've overlooked that would clear or reset the PrintPreview dialog and avoid the confusion this causes the user.
e.HasMorePages = False
e.Cancel = True
Exit Sub
Now when the user returns to the printer set up process and makes corrections to the bogus margin settings, and goes to print again, the process completely skips PrintDocument1.PrintPage event handler and displays a blank page. The 3rd time the user goes through this process, everything works OK (provided the user has set some realistic margins). I'm thinking the "e.Cancel" or the "e.HasMorePages" statement has flipped the process some how. I don't want to dispose and recreate the PrintPreview class every time the user goes to print because of other overhead involved. I'm wondering if there's a property or method that I've overlooked that would clear or reset the PrintPreview dialog and avoid the confusion this causes the user.