i want to get keypress event in windows panel control in c#, is any body help for me...
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
"Panel" objects cannot receive the "KeyPress" event correctly.
I've created
Panel
overload:and used the overridden method
ProcessCmdKey
:to intercept pressed keys:
You should handle the Panel.KeyPress event.
Example
The problem is, that at first your main form got the KeyPress and will immediately send this message to the active control. If that doesn't handle this key press it will be bubbled up to the parent control and so on.
To intercept this chain, you have to in your
Form.KeyPreview
totrue
and add an handler toForm.KeyPress
. Now you can handle the pressed key within your form.Panel + Keypress - C# Discussion Boards - CodeProject
http://www.codeproject.com/Messages/704386/Panel-plus-Keypress.aspx