Keyboard.IsKeyUp(Key) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Avgör om den angivna nyckeln släpps.
public:
static bool IsKeyUp(System::Windows::Input::Key key);
public static bool IsKeyUp(System.Windows.Input.Key key);
static member IsKeyUp : System.Windows.Input.Key -> bool
Public Shared Function IsKeyUp (key As Key) As Boolean
Parametrar
- key
- Key
Nyckeln som ska kontrolleras.
Returer
true if key is in the up state;wise, false.
Exempel
I följande exempel visas hur du använder IsKeyUp metoden för att fastställa tillståndet för en specifik nyckel. Nyckeln Return skickas till IsKeyUp metoden. Om metoden returnerar trueändras bakgrunden för en Button .
// Uses the Keyboard.IsKeyUp to determine if a key is up.
if (Keyboard.IsKeyUp(Key.Return))
{
btnIsUp.Background = Brushes.Red;
}
else
{
btnIsUp.Background = Brushes.AliceBlue;
}
' Uses the Keyboard.IsKeyUp to determine if a key is up.
If Keyboard.IsKeyUp(Key.Return) Then
btnIsUp.Background = Brushes.Red
Else
btnIsUp.Background = Brushes.AliceBlue
End If
Kommentarer
Metoden GetKeyStates kan användas för att fastställa uppsättningen tillstånd för en specifik nyckel.