Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP's ON KEY LABEL in .NET
Message
From
15/03/2007 05:45:10
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01203273
Message ID:
01203892
Views:
15
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform