Artem
Artem

Reputation: 7423

How to catch hardware key press event on Windows Mobile 6?

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#?

Upvotes: 3

Views: 8616

Answers (2)

stevehipwell
stevehipwell

Reputation: 57488

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

Upvotes: 7

Ahmadreza
Ahmadreza

Reputation: 584

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.

Upvotes: 1

Related Questions