[Solved] How to perform an action while a key is pressed [closed]


You can use System.Timers.Timer.

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if(e.KeyCode == Key.A)
    {
        if(!timer1.Enabled)
            timer1.Start();
        else
            timer1.Stop();

    }
}

10

solved How to perform an action while a key is pressed [closed]