private void A_timer_Tick(object sender, EventArgs e) { if (A_x == B_x - 20 && A_y == B_y - 20) { A_timer.Stop(); } else { do { if (A_x < B_x) { A_x++; } else { A_x--; } }while (A_x == B_x - 20); do { if (A_y < B_y) { A_y++; } else { A_y--; } }while (A_y == B_y - 20); Invalidate(); } }
private void button1_Click(object sender, EventArgs e) { A_timer.Stop(); B_timer.Stop(); C_timer.Stop(); D_timer.Stop(); }