Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PrintPreviewDialog1.ShowDialog() unhandled exception

Posted on 2006-06-14
1
Medium Priority
?
416 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

636 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