Close PrintPreviewDialog when ESC is pressed

Posted by Emerick Rogul on Stack Overflow See other posts from Stack Overflow or by Emerick Rogul
Published on 2010-02-03T17:26:20Z Indexed on 2010/06/01 0:23 UTC
Read the original article Hit count: 576

Filed under:
|

I'm working on a WinForms application that uses System.Windows.Forms.PrintPreviewDialog to display a Print Preview dialog. When the user presses ESC in that dialog, I'd like to close the dialog. Unfortunately, I can't figure out how to do this. I've tried to install a KeyDown/PreviewKeyDown event handler, but it never gets called. I also tried setting focus to the dialog (and to its PrintPreviewControl), thinking that was the issue, but that didn't help either. Does anyone have any idea how to make this work?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about print-preview