Patrick Sky

Hi ~

I see from the MSDN document ,it describe for the KeyDown event is "This member is not meaningful for this control.". Although i can assign a event handling method to the Panel class, but the Key Down event never be raise when i key down on the Panel. So,

How to detect the key down event for Panel control Or it have another way to detect the key down event for Panel

Thank ~



Re: Windows Forms General How to detect the key down event for Panel control?

tkerns

I think that the Panel control doesn't raise the KeyDown event because it can never receive focus. Maybe if you explain what you're trying to do, someone here can be more helpful.

Tony





Re: Windows Forms General How to detect the key down event for Panel control?

Patrick Sky

I am now implementing the drawing tool. I choose to use Panel to hold the drawing area so that the user can draw anything on the surface on this Panel. When i implement the delete object function that is select one of the object/shape on the Panel that user drew before and then press the delete button to delete selected object/shape. So it need to know the key down event for Panel and through the event can get the delete button was pressed. That is why i need the key event.

Thank You ~





Re: Windows Forms General How to detect the key down event for Panel control?

Jessica

Try setting ControlStyles.Selectable and overriding IsInputKey.

Scroll down to (why doesn't this work for Panel)
http://blogs.msdn.com/jfoscoding/archive/2006/01/26/518181.aspx





Re: Windows Forms General How to detect the key down event for Panel control?

JDee

Hi Patrick Sky,

This post (http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1247236&SiteID=1) might help you.

Thanks,

JDee