views:

1893

answers:

2

I'm trying to catch hardware key press events on Windows Mobile 6.x with .NET 3.5 I have a form with buttons and other controls on it and I need to catch when keys left, right, up, and down are pressed. Unfortunately, with approach described in MSDN:

http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.hardwarekeys.aspx

all these keys still move cursor between buttons on the form instead of triggering my Form1_KeyDown() event. (I have HardwareButtons with associated control Form1 and HardwareKey set up).

Is there any way of catching these key press events in C#?

+1  A: 

I think you have to put 6 HardwareButtons in your form and associate control property to your form and each HardwareButton's HarwareKey property should be set to ApplicationKey1 to ApplicationKey6 relatively.

Ahmadreza
+3  A: 

If you set the form's KeyPreview property to true you can catch the form's KeyDown event.

Stevo3000
It helped, thank you! :)
Artem