Keyboard.IsKeyToggled(Key) 메서드

정의

지정한 키가 전환되었는지 여부를 확인합니다.

public:
 static bool IsKeyToggled(System::Windows::Input::Key key);
public static bool IsKeyToggled (System.Windows.Input.Key key);
static member IsKeyToggled : System.Windows.Input.Key -> bool
Public Shared Function IsKeyToggled (key As Key) As Boolean

매개 변수

key
Key

지정한 키입니다.

반환

key가 전환된 상태이면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 사용 하는 방법의 IsKeyToggled 특정 키의 상태를 확인 하는 방법입니다. 합니다 Return 키에 전달 되는 IsKeyToggled 메서드. 메서드에서 반환 되 면 true의 배경을 Button 변경 됩니다.

// Uses the Keyboard.IsToggled to determine if a key is toggled.
if (Keyboard.IsKeyToggled(Key.Return))
{
    btnIsToggle.Background = Brushes.Red;
}
else
{
    btnIsToggle.Background = Brushes.AliceBlue;
}
' Uses the Keyboard.IsToggled to determine if a key is toggled.
If Keyboard.IsKeyToggled(Key.Return) Then
    btnIsToggle.Background = Brushes.Red
Else
    btnIsToggle.Background = Brushes.AliceBlue
End If

설명

GetKeyStates 메서드는 특정 키 상태 집합을 결정 데 사용할 수 있습니다.

적용 대상

추가 정보