private void button1_Click(object sender, EventArgs e) { md = new MD(int.Parse(textBox6.Text), int.Parse(textBox5.Text)); Point pt = new Point(md.X(), md.Y()); pictureBox1.Location = pt; progressBar1.Value = 0; label1.Text = "Лечение " + progressBar1.Value; mn = new Man(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); timer2.Stop(); timer1.Start(); }
public void Moving(PictureBox pb, Man man, MD md, Timer tm1, Timer tm2) { Point pt; if ((man.Y() != md.Y()) || ((man.X() != md.X()))) { if (!(man.X() == md.X())) { man.changeX(man.X() < md.X()); } if (!(man.Y() == md.Y())) { man.changeY(man.Y() < md.Y()); } pt = new Point(man.X(), man.Y()); pb.Location = pt; } else { tm1.Stop(); tm2.Start(); } }