private void C_timer_Tick(object sender, EventArgs e) { if (C_x == D_x - 20 && C_y == D_y - 20) { C_timer.Stop(); } else { do { if (C_x < D_x) { C_x++; } else { C_x--; } }while (C_x == D_x - 20); do { if (C_y < D_y) { C_y++; } else { C_y--; } }while (C_y == D_y - 20); Invalidate(); } }
private void button1_Click(object sender, EventArgs e) { A_timer.Stop(); B_timer.Stop(); C_timer.Stop(); D_timer.Stop(); }