C#, PictureBox, and Keypress?

  • Thread starter Thread starter David M
  • Start date Start date
D

David M

IS there a way to access a keydown event from the .net picturebox
control. I need to display a picture and have the user press the page
up/down key to go to the previous/next pic. I see mouse events but not
keypress. If the PB does not have this, then is there a way to
intercept a kepress from any control on the form?

Thanks
 
David,

You could derive a class from PictureBox and then intercept the
appropriate windows messages. You can intercept the WM_KEYDOWN message to
find out when a key is pressed when the PictureBox has focus. Then, just do
what you have to do when the appropriate key is pressed.

Hope this helps.
 
Back
Top