Solved

PrintPreviewDialog1.ShowDialog() unhandled exception

Posted on 2006-06-14
1
391 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 500 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now