private void start_thread_parse() { while (true) { figure.MoveRight(pictureBox1); Thread.Sleep(Convert.ToInt32(numericUpDown1.Value)); this.Invoke(new MethodInvoker(delegate { pictureBox1.Refresh(); })); } }
private Action GenerateMove(Figure figure) { return(() => { while (true) { figure.MoveRight(pictureBox1); Thread.Sleep(ToInt32(100)); Invoke(new MethodInvoker(() => pictureBox1.Refresh())); if (figure.x == pictureBox1.Size.Width) { break; } } }); }