方法 : オーバーライド Smartphone ソフト キー

[このドキュメントはプレビュー版であり、後のリリースで変更されることがあります。 空白のトピックは、プレースホルダーとして挿入されています。]

Smartphone のソフト キー通常、メニューの動作します。ただし、カスタムのソフト キー機能をフォームから、MainMenu コンポーネントを削除して提供できます。 Smartphone アプリケーションでメニューがない場合ソフト キー 1 とソフト キーの 2 機は、続いて、キーが離されたときに、KeyDown イベント KeyUp イベントを発生します。

KeyCode フィールドは、 F1 をソフト キー 1 と F2 ソフト キー 2 として認識します。

使用例

ソフト キーの押下のコードを処理するイベントを提供するコード例を次に示します。

フォームのコンストラクターで KeyPress イベントに対して、イベント ハンドラーを定義する Visual C# ユーザー必要があります。

                        // Connect an event handler to the KeyPress event
                        this.KeyPress += new KeyPressEventHandler(OnKeyPress);
                        Private
                        Sub keypressed(ByVal o As [Object], _
    ByVal e As KeyPressEventArgs) HandlesMyBase.KeyPress
     ' Determine if ESC key value is raised.If e.KeyChar = ChrW(27) Then         ' Handle the event to provide your own functionality.
         e.Handled = True
         ' Add  your event handling code here.
         MessageBox.Show("Custom back key functionality.")  
     EndIfEndSub
                        private
                        void OnKeyPress(object sender, KeyPressEventArgs ke)
{
  // Determine if ESC key value is raised.if (ke.KeyChar == (Char)Keys.Escape)
  {
      // Handle the event to provide functionality.
      ke.Handled = true;

      // Add your event handling code here.
     MessageBox.Show("Custom back key functionality.");
  }
}

コードのコンパイル方法

この例では、次の名前空間への参照が必要です。

参照

処理手順

方法 : Smartphone 戻るキーを上書きします。

その他の技術情報

Smartphone の開発と、.NET Framework を最適化します。