Control.IsKeyLocked, méthode
.NET Framework 2.0
Remarque : cette méthode est nouvelle dans le .NET Framework version 2.0.
Détermine si la touche VERR. MAJ, VERR. NUM., ou ARRÊT DÉFIL est activée.
Espace de noms : System.Windows.Forms
Assembly : System.Windows.Forms (dans system.windows.forms.dll)
Assembly : System.Windows.Forms (dans system.windows.forms.dll)
public static boolean IsKeyLocked ( Keys keyVal )
public static function IsKeyLocked ( keyVal : Keys ) : boolean
Paramètres
- keyVal
VERR. MAJ, VERR. NUM. ARRÊT DÉFIL membres de l'énumération Keys.
Valeur de retour
true si la ou les touches spécifiées sont activées ; sinon, false.L'exemple de code suivant affiche un message indiquant si la touche spécifiée (la touche VERR. MAJ dans ce cas) est activée.
using System; using System.Windows.Forms; public class CapsLockIndicator { public static void Main() { try { // You can test for the Caps Lock, Num Lock, or Scroll Lock key // by changing the value of Keys. Control.IsKeyLocked(Keys.CapsLock); MessageBox.Show("The Caps Lock key is ON."); } catch { MessageBox.Show("The Caps Lock key is OFF."); } } }
import System.*;
import System.Windows.Forms.*;
public class CapsLockIndicator
{
public static void main(String[] args)
{
try {
// You can test for the Caps Lock, Num Lock, or Scroll Lock key
// by changing the value of Keys.
Control.IsKeyLocked(Keys.CapsLock);
MessageBox.Show("The Caps Lock key is ON.");
}
catch (System.Exception exp) {
MessageBox.Show("The Caps Lock key is OFF.");
}
} //main
} //CapsLockIndicator
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.