Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've written a Print Screen routine that captures *all* of the information displayed by my project (2 or 3 forms), saves it to a defined image type in a folder that the operator selects, then displays the image in an external viewer.

 

My operators, however, are still trying to use the "Print Screen" key and pasting their images on their own because they forget that my tool is there.

 

So, I want to capture the "Print Screen" key. I've written these two routines and wired them to the MDI Form, but they never fire:

void MdiForm_KeyDown(object sender, KeyEventArgs e) {
 if (e.KeyCode == Keys.PrintScreen) {
   ScreenCapture(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
   e.Handled = true;
 }
}

void MdiForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
 if (e.KeyCode == Keys.PrintScreen) {
   ScreenCapture(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
 }
}

I'm guessing the problem is that other forms (and their controls) have focus, so the events are being sent to there instead of to my routines.

 

How can I wire up my routine so that I can catch key presses *without* having to wire each and every control to these two events?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...