Solved

How to grab the printer icon click event from PrintDocument

Posted on 2012-03-14
3
228 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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