WinForms Keypress absence solution (C#)? *Solved*

Started by
2 comments, last by GeekPlusPlus 18 years, 10 months ago
Hello, I'm rendering a Direct3D window on a panel control in C# on my main form. The only other control is a drop down list. I want to be able to handle keypress events to change what is rendered by DirectX, but a Panel control doesn't have Keypress events. I thought that the main form would handle the key press events because the panel couldn't, but it's clearly not. Does anyone have a solution for this problem? I'd render the DX result onto the form itself except that the main form can't take focus from the drop down menu, and so I still am not able to handle keypress events on the actual DX window. Thanks - GeekPlusPlus [Edited by - GeekPlusPlus on June 3, 2005 3:15:55 PM]
- Newb Programmer: Geek++
Advertisement
Just from memory, I believe there is a KeyPreview property for the entire form. Try that.
It's hard to say without seeing the form code.
If you are overriding the on keypress event, make sure you are passing anything you don't handle yourself to the base class.
Anything posted is personal opinion which does not in anyway reflect or represent my employer. Any code and opinion is expressed “as is” and used at your own risk – it does not constitute a legal relationship of any kind.
You were 100% correct Andrew, and it works perfectly thanks.

- Newb Programmer: Geek++

This topic is closed to new replies.

Advertisement