KeyGesture コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
KeyGesture クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| KeyGesture(Key) |
指定したKeyGestureを使用して、Key クラスの新しいインスタンスを初期化します。 |
| KeyGesture(Key, ModifierKeys) |
指定したKeyGestureとKeyを使用して、ModifierKeys クラスの新しいインスタンスを初期化します。 |
| KeyGesture(Key, ModifierKeys, String) |
指定したKey、ModifierKeys、および表示文字列を使用して、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は、WindowのInputBindingCollectionに追加されます。
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)
指定したKeyGestureとKeyを使用して、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
ジェスチャに関連付けられている修飾キー。
例外
key
modifiersは有効なKeyGestureを形成しません。
例
次の例では、このコンストラクターを使用して KeyGesture を作成し、 KeyBindingに関連付ける方法を示します。 KeyBindingは、WindowのInputBindingCollectionに追加されます。
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)
指定したKey、ModifierKeys、および表示文字列を使用して、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の文字列形式。
例外
displayString は nullです。
key
modifiersは有効なKeyGestureを形成しません。
注釈
DisplayString プロパティは、displayString パラメーターに設定されます。