HardwareKeys Enumeration
.NET Framework 3.0
Specifies the hardware buttons on a Pocket PC that can be accessed by the HardwareButton class.
Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)
| Member name | Description | |
|---|---|---|
![]() | ApplicationKey1 | Specifies the hardware button that corresponds to application 1. |
![]() | ApplicationKey2 | Specifies the hardware button that corresponds to application 2. |
![]() | ApplicationKey3 | Specifies the hardware button that corresponds to application 3. |
![]() | ApplicationKey4 | Specifies the hardware button that corresponds to application 4. |
![]() | ApplicationKey5 | Specifies the hardware button that corresponds to application 5. |
![]() | ApplicationKey6 | Specifies the hardware button that corresponds to application 6. |
![]() | None | Specifies that no actual hardware buttons are associated with this HardwareButton instance. |
The following code example uses the AssociatedControl and HardwareKey properties to display a form whenever the first and fourth buttons on Pocket PC are pressed. This code example is part of a larger example provided for the HardwareButton class.
// Configure hardware buttons // 1 and 4 to activate the current form. private void HBConfig() { try { hwb1 = new HardwareButton(); hwb4 = new HardwareButton(); hwb1.AssociatedControl = this; hwb4.AssociatedControl = this; hwb1.HardwareKey = HardwareKeys.ApplicationKey1; hwb4.HardwareKey = HardwareKeys.ApplicationKey4; } catch (Exception exc) { MessageBox.Show(exc.Message + " Check if the hardware button is physically available on this device."); } } // When a hardware button is pressed and released, // this form receives the KeyUp event. The OnKeyUp // method is used to determine which hardware // button was pressed, because the event data // specifies a member of the HardwareKeys enumeration. private void OnKeyUp(object sender, KeyEventArgs e) { switch ((HardwareKeys)e.KeyCode) { case HardwareKeys.ApplicationKey1: statusBar1.Text = "Button 1 pressed."; break; case HardwareKeys.ApplicationKey4: statusBar1.Text = "Button 4 pressed."; break; default: break; } }
Community Additions
ADD
Show:
