HardwareKeys-Enumeration

Dieser Dokumentation für die Vorschau nur ist und in späteren Versionen geändert. Leere Themen wurden als Platzhalter eingefügt.]

Gibt die Hardwaretasten auf einem Pocket PC, auf die von der HardwareButton-Klasse zugegriffen werden kann.

Namespace:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

Syntax

'Declaration
Public Enumeration HardwareKeys
'Usage
Dim instance As HardwareKeys
public enum HardwareKeys
public enum class HardwareKeys
type HardwareKeys

Member

Membername Beschreibung
Wird von .NET Compact Framework unterstützt None Gibt an, dass keine tatsächlichen Hardware Schaltflächen dieser HardwareButton-Instanz zugeordnet sind.
Wird von .NET Compact Framework unterstützt ApplicationKey1 Gibt die Taste für Anwendung 1 an.
Wird von .NET Compact Framework unterstützt ApplicationKey2 Gibt die Taste für Anwendung 2 an.
Wird von .NET Compact Framework unterstützt ApplicationKey3 Gibt die Taste für Anwendung 3 an.
Wird von .NET Compact Framework unterstützt ApplicationKey4 Gibt die Taste für Anwendung 4 an.
Wird von .NET Compact Framework unterstützt ApplicationKey5 Gibt die Taste für Anwendung 5 an.
Wird von .NET Compact Framework unterstützt ApplicationKey6 Gibt die Taste für Anwendung 6 an.

Ausnahmen

Ausnahme Bedingung
NotSupportedException

Hinweise

Das Formular oder einen Member dieser Enumeration zugeordnete Steuerelement erhalten die KeyDownund KeyUp Ereignisse, wenn die entsprechende Hardware-Schaltfläche gedrückt wird.

Hinweis

Die Hardwaretasten entsprechen der Anwendungsschlüssel auf einem Pocket PC.Der Anwendungsschlüssel sind nicht in die Kerngruppe Schlüssel enthalten, so dass Ihre Hardware Tastenzuordnung aus ein Tastaturlayout zur nächsten variieren.Nur die Hardware Schlüssel Standardzuordnung auf dem Gerät wird unterstützt.

Diese Enumeration wird nicht unterstützt und löst eine NotSupportedException auf dem Smartphone und anderen Windows CE-Geräten, die keine Pocket PCs sind.

Beispiele

Im folgenden Codebeispiel wird die AssociatedControlHardwareKey Eigenschaften und ein Formular angezeigt, sobald die ersten und vierten auf Pocket PC gedrückt werden verwendet.Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die HardwareButton-Klasse bereitgestellt wird.

PrivateSub ConfigHWButton()
   'Set KeyPreview to true so that the form    'will receive key events before they    'are passed to the control that has focus. Me.KeyPreview = True

      hwb1 = New HardwareButton()
      hwb4 = New HardwareButton()

   'Set the AssociatedControl property   'to the current form and configure the   'first and fourth buttons to activate the form.Try
      hwb1.AssociatedControl = Me
      hwb4.AssociatedControl = Me
      hwb1.HardwareKey = HardwareKeys.ApplicationKey1
      hwb4.HardwareKey = HardwareKeys.ApplicationKey4
   Catch exc As Exception
      MessageBox.Show(exc.Message + " Check if the hardware button is physically available on this device.")
   EndTryEndSubPrivateOverloadsSub OnKeyUp(sender AsObject, e As KeyEventArgs) HandlesMyBase.KeyUp
    ' 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.SelectCaseCType(e.KeyCode, HardwareKeys)
      Case HardwareKeys.ApplicationKey1
         statusBar1.Text = "Button 1 pressed."Case HardwareKeys.ApplicationKey4
         statusBar1.Text = "Button 4 pressed."CaseElseEndSelectEndSub
// Configure hardware buttons// 1 and 4 to activate the current form.privatevoid 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.privatevoid 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;
    }
}

Plattformen

Windows CE, Windows Mobile für Smartphone, Windows Mobile für Pocket PC

Die .NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET framework.

Versionsinformationen

.NET Compact Framework

Unterstützt in: 3.5, 2.0

Siehe auch

Referenz

Microsoft.WindowsCE.Forms-Namespace

Weitere Ressourcen

SO WIRD'S GEMACHT: Verwenden Sie die HardwareButton-Komponente