[C#] Buttons and shortcuts

Sep 6 2011 3:48 AM
So i wan't to make a shortcut for a button on my form, and it is controlling a timer, i wan't the timer to stop when i press Ctrl + L and it work's but only when the form is in focus, i wan't the shortcut to work when it's out of focus ect. when im on the desktop.

Heres my simple code that works when it's in focus :/

Oh, and if this topic is in the wrong section of the forum, feel free to move it, i couldn't really see other places to have this.

        private void Form2_KeyDown_1(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.L)
            {
                timer1.Stop();
            }


Answers (7)