7
Answers

[C#] Buttons and shortcuts

Ask a question
Mikkel Larsen

Mikkel Larsen

13y
1.6k
1
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)