Développer Réduire
Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Control.IsKeyLocked, méthode

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)

public static bool IsKeyLocked (
	Keys keyVal
)
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.
Type d'exceptionCondition

NotSupportedException

Le paramètre keyVal fait référence à une touche autre que VERR. MAJ, VERR. NUM. ou ARRÊT DÉFIL.

Utilisez la propriété IsKeyLocked pour déterminer si une ou plusieurs des touches VERR. MAJ, VERR. NUM. ou ARRÊT DÉFIL sont activées.

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.

.NET Framework

Prise en charge dans : 2.0
Cela vous a-t-il été utile ?
(1500 caractères restants)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.