HardwareKeys 列挙体とは? わかりやすく解説

HardwareKeys 列挙体

HardwareButton クラスによってアクセスできる Pocket PCハードウェア ボタン指定します

名前空間: Microsoft.WindowsCE.Forms
アセンブリ: Microsoft.WindowsCE.Forms (microsoft.windowsce.forms.dll 内)
構文構文

public enum HardwareKeys
public enum class HardwareKeys
public enum HardwareKeys
public enum HardwareKeys
メンバメンバ
解説解説

この列挙体のメンバ関連付けられたフォームまたはコントロールは、対応するハードウェア ボタン押されたときに、KeyDown イベントおよび KeyUp イベント受け取ることができます

この列挙体は、Smartphone および Pocket PC 以外の Windows CE デバイスではサポートされていないため、NotSupportedExceptionスローさます。

使用例使用例

AssociatedControl プロパティHardwareKey プロパティ使用してPocket PC1 つ目のボタン4 つ目のボタン押されるたびにフォーム表示するコード例次に示します。このコード例は、HardwareButton クラストピック取り上げているコード例一部分です。

Private Sub 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
      MsgBox(exc.Message + " Check if the hardware button is physically
 available on this device.")
   End Try
 End Sub

Private Overloads Sub OnKeyUp(sender
 As Object, e As KeyEventArgs)
 Handles MyBase.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.
    Select Case CType(e.KeyCode, HardwareKeys)
      Case HardwareKeys.ApplicationKey1
         statusBar1.Text = "Button 1 pressed."
      
      Case HardwareKeys.ApplicationKey4
         statusBar1.Text = "Button 4 pressed."
      
      Case Else
   End Select
End Sub
// 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;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HardwareKeys 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HardwareKeys 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS