Solved

How to grab the printer icon click event from PrintDocument

Posted on 2012-03-14
3
229 Views
Last Modified: 2012-05-08
I am using PrintDocument for printing my reports.  My boss has required that the report do this sequence of actions:

1. Preview report
2. When printer button is clicked, go to a PrintDialog to edit printer settings
3. Print report

Now, I've found that I can assign a BeginPrint event to the document, but that triggers both when the preview is printed and when the printer icon is clicked.  I need something that is going to catch the print icon click event from the preview of a PrintDocument.
0
Comment
Question by:FrancineTaylor
[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
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37724443
Are you using a PrintDocument, PrintPreviewControl, and a PrintDialog in combination, as described in this article?

The Print Dialog Box
http://www.functionx.com/vcsharp2008/controls/dlgprint.htm
0
 
LVL 1

Author Comment

by:FrancineTaylor
ID: 37758357
This doesn't tell me anything about the PrintPreviewDialog, which is what is used to preview a report for a PrintDocument.  The ShowDialog() method on the PrintPreviewControl displays the report in the form, and presents the user with a "print" button.

If that button is clicked, the report prints.

I need to be able to intercept that button click so I can present the user with a PrintDialog before printing occurs.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 37758572
There isn't any event that you can catch.  The button is an internal member to that control.  What I did in the past is to use reflection to find a reference to the button, and attach an event handler to the catch the Click event.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

724 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