?
Solved

PrintPreviewDialog1.ShowDialog() unhandled exception

Posted on 2006-06-14
1
Medium Priority
?
425 Views
Last Modified: 2008-02-01
I have a private function in my program called OnPrintPage, this adds images using e.Graphics.DrawImage(MyImage, x, y) to the printing area. X and y are incremented in OnPrintPage so as to add a selection of images for printing. The entire function OnPrintPage completes without exceptions, however when a call to ShowDialog on a PrintPreviewDialog is made an unhandled exception occurs. THis only happens when the images fall outside the first page. With a couple of images, it works fine. With more images than there is available space for y I get this error.

What should I do to print onto multiple pages??
0
Comment
Question by:craigdev
1 Comment
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 16900769
Printing is done in the PrintDocument PrintPage event handler. This function has PrintPageEventArgs e parameter. This function must print only current page, and call:
e.HasMorePages = false
to stop printing, or
e.HasMorePages = true
to continue printing. If HasMorePages is set to true, PrintPage function is called again and prints next page.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question