次の方法で共有


KeyGesture コンストラクター

定義

KeyGesture クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
KeyGesture(Key)

指定したKeyGestureを使用して、Key クラスの新しいインスタンスを初期化します。

KeyGesture(Key, ModifierKeys)

指定したKeyGestureKeyを使用して、ModifierKeys クラスの新しいインスタンスを初期化します。

KeyGesture(Key, ModifierKeys, String)

指定したKeyModifierKeys、および表示文字列を使用して、KeyGesture クラスの新しいインスタンスを初期化します。

KeyGesture(Key)

指定したKeyGestureを使用して、Key クラスの新しいインスタンスを初期化します。

public:
 KeyGesture(System::Windows::Input::Key key);
public KeyGesture(System.Windows.Input.Key key);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key -> System.Windows.Input.KeyGesture
Public Sub New (key As Key)

パラメーター

key
Key

このジェスチャに関連付けられているキー。

例外

key は有効な Keyではありません。

key は有効な KeyGestureではありません。

次の例では、このコンストラクターを使用して KeyGesture を作成し、 KeyBindingに関連付ける方法を示します。 KeyBindingは、WindowInputBindingCollectionに追加されます。

KeyGesture OpenCmdKeyGesture = new KeyGesture(Key.F12);
KeyBinding OpenKeyBinding = new KeyBinding(
    ApplicationCommands.Open,
    OpenCmdKeyGesture);

this.InputBindings.Add(OpenKeyBinding);
Dim OpenCmdKeyGesture As New KeyGesture(Key.F12)
Dim OpenKeyBinding As New KeyBinding(ApplicationCommands.Open, OpenCmdKeyGesture)

Me.InputBindings.Add(OpenKeyBinding)

注釈

ほとんどの場合、 KeyGesture は 1 つ以上の ModifierKeysに関連付ける必要があります。 この規則の例外は、ファンクション キーとテンキー キーであり、それ自体で有効な KeyGesture にすることができます。

こちらもご覧ください

適用対象

KeyGesture(Key, ModifierKeys)

指定したKeyGestureKeyを使用して、ModifierKeys クラスの新しいインスタンスを初期化します。

public:
 KeyGesture(System::Windows::Input::Key key, System::Windows::Input::ModifierKeys modifiers);
public KeyGesture(System.Windows.Input.Key key, System.Windows.Input.ModifierKeys modifiers);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key * System.Windows.Input.ModifierKeys -> System.Windows.Input.KeyGesture
Public Sub New (key As Key, modifiers As ModifierKeys)

パラメーター

key
Key

ジェスチャに関連付けられているキー。

modifiers
ModifierKeys

ジェスチャに関連付けられている修飾キー。

例外

modifiers が無効です ModifierKeys

-又は-

key は有効な Keyではありません。

key modifiersは有効なKeyGestureを形成しません。

次の例では、このコンストラクターを使用して KeyGesture を作成し、 KeyBindingに関連付ける方法を示します。 KeyBindingは、WindowInputBindingCollectionに追加されます。

KeyGesture CloseCmdKeyGesture = new KeyGesture(
    Key.L, ModifierKeys.Alt);

KeyBinding CloseKeyBinding = new KeyBinding(
    ApplicationCommands.Close, CloseCmdKeyGesture);

this.InputBindings.Add(CloseKeyBinding);
Dim CloseCmdKeyGesture As New KeyGesture(Key.L, ModifierKeys.Alt)

Dim CloseKeyBinding As New KeyBinding(ApplicationCommands.Close, CloseCmdKeyGesture)

Me.InputBindings.Add(CloseKeyBinding)

注釈

ほとんどの場合、 KeyGesture は 1 つ以上の ModifierKeysに関連付ける必要があります。 この規則の例外は、ファンクション キーとテンキー キーであり、それ自体で有効な KeyGesture にすることができます。

こちらもご覧ください

適用対象

KeyGesture(Key, ModifierKeys, String)

指定したKeyModifierKeys、および表示文字列を使用して、KeyGesture クラスの新しいインスタンスを初期化します。

public:
 KeyGesture(System::Windows::Input::Key key, System::Windows::Input::ModifierKeys modifiers, System::String ^ displayString);
public KeyGesture(System.Windows.Input.Key key, System.Windows.Input.ModifierKeys modifiers, string displayString);
new System.Windows.Input.KeyGesture : System.Windows.Input.Key * System.Windows.Input.ModifierKeys * string -> System.Windows.Input.KeyGesture
Public Sub New (key As Key, modifiers As ModifierKeys, displayString As String)

パラメーター

key
Key

ジェスチャに関連付けられているキー。

modifiers
ModifierKeys

ジェスチャに関連付けられている修飾キー。

displayString
String

KeyGestureの文字列形式。

例外

modifiers が無効です ModifierKeys

-又は-

key は有効な Keyではありません。

displayStringnullです。

key modifiersは有効なKeyGestureを形成しません。

注釈

DisplayString プロパティは、displayString パラメーターに設定されます。

こちらもご覧ください

適用対象