Keyboard.GetKeyStates Method (Key)
Gets the set of key states for the specified key.
Assembly: PresentationCore (in PresentationCore.dll)
KeyStates is a bit field enumeration; therefore, it is possible for a key to be in multiple states. For example, a key could be in the pressed state as well as in the toggled state. Use bit comparison operations to determine the exact state or states the key is in.
The following example shows how to use the Return key is in the Down state. A bit AND operation is used to compare the KeyStates returned from and the Down state. If the key is down, the background of a Button is changed.method to determine if the
Available since 3.0