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? 2 4134
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike M |
last post by:
I am trying to detect the keydown of the arrow keys in a
custom control that I am writing. As far as I can tell,
pressing the arrow keys does not fire the KeyDown event
at all. It behaves just...
|
by: bardo |
last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to
reconize the arrow keys. But I have no luck at all. The problem is that the
keydown event won't fire at all, unless I...
|
by: Will Gillen |
last post by:
I am building a hoem theatre app that is controlled by an IR Remote Control.
The Remote has some keys that map to "keyboard" commands (i.e. PageUp,
PageDown.).
In this VB.NET application I have...
|
by: Rud |
last post by:
Hello,
As soon as I set the form "isMdiContainer = true", the arrow keys are not
captured by the forms KeyDown routine anymore. All other keys are nicely
captured. When a child form is created...
|
by: Rlrcstr |
last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger
a KeyPress or KeyDown event. Thanks.
Jerry
|
by: anoehre_1 |
last post by:
Hi!
Very simple Application:
-------------------------------
this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
|
by: ShaneO |
last post by:
I would like to handle the KeyUp & KeyDown events in the same event
handler but can't find how to determine which event was fired -
Private Sub ListBox1_KeyUp(ByVal sender As Object, ByVal e As...
|
by: Rob |
last post by:
If I use the following code:
Private Sub Form1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles MyBase.KeyDown
Dim myKey As Integer
myKey =...
|
by: boopsboops |
last post by:
Hi thescripts people, I hope I'm in the right forum for Visual Basic Dotnet (VS 2005).
I am trying to make a custom control in which you can nudge a point around using the arrow keys. Actually,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |