|
Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte.
|
Traduction
Source
|
ToolStripDropDown.ProcessMnemonic, méthode
Assembly : System.Windows.Forms (dans System.Windows.Forms.dll)
[UIPermissionAttribute(SecurityAction.LinkDemand, Window = UIPermissionWindow.AllWindows)] protected internal override bool ProcessMnemonic( char charCode )
Paramètres
- charCode
- Type : System.Char
Le caractère à traiter.
Valeur de retour
Type : System.Booleanif (CanSelect && IsMnemonic(charCode, MyControl.Text) { // Perform action associated with mnemonic. }
// This button is a simple extension of the button class that overrides // the ProcessMnemonic method. If the mnemonic is correctly entered, // the message box will appear and the click event will be raised. public class MyMnemonicButton:Button // This method makes sure the control is selectable and the // mneumonic is correct before displaying the message box // and triggering the click event. { [UIPermission( SecurityAction.Demand, Window = UIPermissionWindow.AllWindows)] protected override bool ProcessMnemonic(char inputChar) { if (CanSelect&&IsMnemonic(inputChar, this.Text)) { MessageBox.Show("You've raised the click event " + "using the mnemonic."); this.PerformClick(); return true; } return false; } }
To run this example paste the following code after a form class, in the same file. Add a button of type MnemonicButton to the form.
- UIPermission
pour toutes les fenêtres pour permettre aux classes qui héritent d'appeler cette méthode. Énumération associée : valeur AllWindows de UIPermissionWindow.
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.