PrintPreviewDialog Print Button



I am using PrintPreviewDialog to preview a file. There is a button that the
user can press, which seems to print the file to the default printer. I would
like to capture a click on that button so that I can present a PrintDialog,
print some files in a special way, etc. But there does not seem to be an
event among the PrintPreviewDialog members to do this? Or perhaps I missed
it? I would appreciate any suggestions. Thanks.

Bruce Wood

PrintPreviewDialog is strangely a closed architecture. It's terribly
difficult to inherit from it and change its behaviour. I wanted to do
the same thing you've done, and I saw only two options:

1. Create my own PrintPreviewDialog. After all, PrintPreviewDialog is
just a PrintPreviewControl wrapped in a window with some buttons on it.
In fact, I have no idea why the folks at Microsoft just didn't publish
the code to PrintPreviewDialog and open it wide up, since it's probably
just a couple of hundred lines of code. Nonetheless, it seemed a lot of

2. I inherited from PrintPreviewDialog and added a File menu with a
Print option. _that_ option brings up the print dialog. If the user
hits the printer button it still just prints to the default printer.


That's what I thought, but I could not really believe it was so. I was going
to use a PrintPreviewControl, but then I would have to write the other
buttons, I assume. But it sounds like that is the best choice. Thanks for the

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question