Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP's ON KEY LABEL in .NET
Message
De
15/03/2007 05:45:10
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01203273
Message ID:
01203892
Vues:
13
For a combination of keys take a look at the KeyDown event; in my example I check for CTRL + A and ESCAPE
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 frm = new Form1();
            frm.KeyPress += new KeyPressEventHandler(new KeyPressCode().keypressEvent);
            frm.KeyDown += new KeyEventHandler(new KeyPressCode().keydownEvent);
            Application.Run(frm);
        }
    }

    public class KeyPressCode
    {
        public void keypressEvent(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Escape)
            {
                MessageBox.Show("Key ESCAPE pressed.");
            }
        }

        public void keydownEvent(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.A)
            {
                MessageBox.Show("Key CTRL + A pressed");
            }
        }
    }
>Robert,
>
>It seems to me that combination of keys is not possible as I looked at the possible keys available in Keys enumeration and there is none i.e. Ctrl+A, Ctrl+B, etc. Would it be possible to have combination of keys just like the SendKey.Send function?
>
>Thanks for your response!
robert.oh.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform