private void btnClearOrStop_Click(object sender, EventArgs e) { if (animation == DEFINE.EAnimation.Stop) { // xoa w.Erase(); w = new Model.Wheel(new Point(200, 200), 50, Color.Red, new Point(speedMoveBase * tbVelocity.Value, 0), speedRotateBase, ref bm); w.Draw(); pbDraw.Image = bm; animation = DEFINE.EAnimation.Start; btnStartOrPause.Text = "Start"; btnClearOrStop.Text = "Stop"; btnClearOrStop.Enabled = false; btnStartOrPause.Enabled = true; pnlRotate.Enabled = true; tbRotate.Value = 1; tbVelocity.Value = 1; } if (animation == DEFINE.EAnimation.Running || animation == DEFINE.EAnimation.Pause) { animation = DEFINE.EAnimation.Stop; btnClearOrStop.Text = "Clear"; btnStartOrPause.Enabled = false; } }
public ucWheelMove() { InitializeComponent(); bm = new Bitmap(pbDraw.Size.Width, pbDraw.Size.Height); w = new Model.Wheel(new Point(200, 200), 50, Color.Red, new Point(speedMoveBase * tbVelocity.Value, 0), speedRotateBase, ref bm); w.Draw(); pbDraw.Image = bm; }