Click here to Skip to main content
15,887,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys,

i have one mdiform and in that i have a drawing canvas and now i want to add keydown event in mdiform i have tried it and so it work on mdiform but when i press on the canvas which is in mdiform it does't work .......

does anyone having solution of this then reply me .......
Posted
Comments
Argonia 4-Jun-12 6:55am    
are you sure that the right mdiform is active? check if you haven't attach the event to the wrong form
chirudi 4-Jun-12 7:08am    
ya mdiform is the right one which i have selected .........
Shahin Khorshidnia 5-Jun-12 2:02am    
Canvas? Is it WPF?

1 solution

In System.Windows.Forms.Form the active control will receive the key events. Hence, in the above case when the canvas is active it may be receiving the KeyDown event.

To enable the form to receive the key events before the event is passed to the control that has focus, set the Form.KeyPreview property to true as explained here http://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900