Wenn ich w/A/S/D auf keyobard klicke, misst es nicht die Zeit zwischen zwei geklicktem Schlüssel, sondern die ganze Zeit. Hier ist meine komplette Code:Messzeit zwischen den Tasten geklickt
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
stopwatch1.Start();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
if (e.KeyChar == (char)Keys.W)
{
textBox1.Text = textBox1.Text + "W (" + stopwatch1.ElapsedMilliseconds + ") + ";
}
else if (e.KeyChar == (char)Keys.A)
{
textBox1.Text = textBox1.Text + "A (" + stopwatch1.ElapsedMilliseconds + ") + ";
}
else if (e.KeyChar == (char)Keys.S)
{
textBox1.Text = textBox1.Text + "S (" + stopwatch1.ElapsedMilliseconds + ") + ";
}
else if (e.KeyChar == (char)Keys.D)
{
textBox1.Text = textBox1.Text + "D (" + stopwatch1.ElapsedMilliseconds + ") + ";
}
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
stopwatch1.Stop();
}
}
}
Beispiel Ausgabe:
W (560) + A (634) + S (753) + D (846) + A (944) +
Und was ich will ist zum Beispiel:
W (560) + A (128) + S (82)
Kann jemand helfen?
Ich meinte du hast * zwei Ereignisse, die kollidieren ... –