473,699 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
2 4168
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
Excellent. That does the trick. Thanks.
"Chris" <no@spam.com> wrote in message
news:ul******** ******@TK2MSFTN GP09.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
34541
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 like the tab key, passing focus to the next control in the tab order. The only events that fire are in the lost focus sequence (leave, validating, validated, etc.) Any ideas?
3
9226
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 click on a row (withs will turn blue then) and then click on it again . Now if I press any key the event will fire (except for the arrow keys). I also tried to override the IsInputKey => no luck. I also tried to override the ProcessCmdKey => With...
2
7250
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 a listbox control that I fill with songs from the MediaPlayer Library (MediaCollection). Now, my remote does not have "Tab" key or "up" and "down" arrow keys, but it does have pageup, pagedown. I want the PageUp, PageDwn to "behave" like the...
0
965
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 also there the arrow keys are not raising the child's KeyDown event. See my sample code below: (for Form1: "isMdiContainer = true", and "KeyPreview = true")
11
2800
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
2
5108
by: anoehre_1 | last post by:
Hi! Very simple Application: ------------------------------- this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
4
7126
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 System.Windows.Forms.KeyEventArgs) _ Handles ListBox1.KeyUp, ListBox1.KeyDown If e.KeyValue = Keys.PageDown Or e.KeyValue = Keys.PageUp Or e.KeyValue = Keys.End Or e.KeyValue = Keys.Home Then
5
1799
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 = e.KeyValue MsgBox(myKey.ToString)
4
3289
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, the control is meant to be a simple drawing program. To test it out I have put the control on a Windows form which also contains several buttons. I have added a KeyDown event handler to the custom control (see code below). It responds fine to keys...
0
8623
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9187
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9053
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8894
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7776
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.