2010-03-10 17:56:02 UTC
application is very trivial to this point with just three components: the
form, an outer panel and an inner panel. The form hosts the outer panel and
the outer panel hosts the inner panel.
I have set up event handlers for the inner panel to test for which events
are being seen by the panel. To my surprize the panel does not fire any of
the key events or the mouse wheel event, but the mouse click and move events
are fired just fine. I have also noted that the panels never gets focus.
Here is the code:
pnlInner.KeyDown += new KeyEventHandler( pnlInner_KeyDown );
pnlInner.KeyUp += new KeyEventHandler( pnlInner_KeyUp );
pnlInner.PreviewKeyDown += new PreviewKeyDownEventHandler(
pnlInner.MouseDown += new MouseEventHandler( pnlInner_MouseDown );
pnlInner.MouseUp += new MouseEventHandler( pnlInner_MouseUp );
pnlInner.MouseMove += new MouseEventHandler( pnlInner_MouseMove );
pnlInner.MouseWheel += new MouseEventHandler( pnlInner_MouseWheel );
pnlInner.MouseDoubleClick += new MouseEventHandler(
I really need to see the key events in the inner panel. The intent is to
use the panel as a Direct3D drawing surface and have the user interact with
the displayed graphics by using various mouse actions in combination with
keys like Shift and Control. A left mouse click by itself might mean center
image at the current mouse location and a left mouse click with the Shift key
held down might mean center and zoom in the image.
How can I get the panel to fire the above key related events?