Assembly: PresentationCore (in presentationcore.dll)
The specified key.
Return ValueThe set of key states.
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 operations to determine the exact state or states the key is in.
The following example shows how to use the GetKeyStates method to determine if the Return key is in the Down state. A bit AND operation is used to compare the KeyStates returned from GetKeyStates and the Down state. If the key is down, the background of a Button is changed.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.