Solved

How to grab the printer icon click event from PrintDocument

Posted on 2012-03-14
3
223 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
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

12 Experts available now in Live!

Get 1:1 Help Now