By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Arrow Keys, PageUp, PageDn etc. Not Firing KeyDown Event

P: n/a
I have a Panel control docked on all sides on a form and the panel control
contains a PictureBox. I'm using the KeyDown event of the form to respond to
the [+] and [-] keys for resizing the image and the PageUp, PageDn, Home,
End, and arrow keys for scrolling the Panel control.

Resizing the image using the [+] and [-] keys works fine, deriving a resized
thumbnail from the image and reassigning it to the Image property of the
PictureBox. However I'm running into a problem where the scrolling keys are
placing the form into a state where it suddenly no longer responds to any
keys. KeyDown and KeyPress will no longer fire, unless I quit the program
and restart it.

Could there be something else that might be capturing the other keys and
altering the functionality of the form? I had placed two buttons on the form
and noticed that the arrow keys were toggling the focus between the two
buttons, rather than scrolling the Panel.

Question:
How can I get the "scrolling" keys to fire the KeyDown event and prevent the
form from getting into that apparently form-editing state?
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Phil Galey wrote:
I have a Panel control docked on all sides on a form and the panel control
contains a PictureBox. I'm using the KeyDown event of the form to respond to
the [+] and [-] keys for resizing the image and the PageUp, PageDn, Home,
End, and arrow keys for scrolling the Panel control.

Resizing the image using the [+] and [-] keys works fine, deriving a resized
thumbnail from the image and reassigning it to the Image property of the
PictureBox. However I'm running into a problem where the scrolling keys are
placing the form into a state where it suddenly no longer responds to any
keys. KeyDown and KeyPress will no longer fire, unless I quit the program
and restart it.

Could there be something else that might be capturing the other keys and
altering the functionality of the form? I had placed two buttons on the form
and noticed that the arrow keys were toggling the focus between the two
buttons, rather than scrolling the Panel.

Question:
How can I get the "scrolling" keys to fire the KeyDown event and prevent the
form from getting into that apparently form-editing state?


Capture the ProcessCmdKey event. It will give you access to those keys.

Chris
Nov 21 '05 #2

P: n/a
Excellent. That does the trick. Thanks.
"Chris" <no@spam.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Phil Galey wrote:
I have a Panel control docked on all sides on a form and the panel control contains a PictureBox. I'm using the KeyDown event of the form to respond to the [+] and [-] keys for resizing the image and the PageUp, PageDn, Home, End, and arrow keys for scrolling the Panel control.

Resizing the image using the [+] and [-] keys works fine, deriving a resized thumbnail from the image and reassigning it to the Image property of the
PictureBox. However I'm running into a problem where the scrolling keys are placing the form into a state where it suddenly no longer responds to any keys. KeyDown and KeyPress will no longer fire, unless I quit the program and restart it.

Could there be something else that might be capturing the other keys and
altering the functionality of the form? I had placed two buttons on the form and noticed that the arrow keys were toggling the focus between the two
buttons, rather than scrolling the Panel.

Question:
How can I get the "scrolling" keys to fire the KeyDown event and prevent the form from getting into that apparently form-editing state?


Capture the ProcessCmdKey event. It will give you access to those keys.

Chris

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.