Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 private void btnStartOrPause_Click(object sender, EventArgs e)
 {
     if (animation == DEFINE.EAnimation.Start)
     {
         double sizeDir = Math.Sqrt(r.Direction.X * r.Direction.X + r.Direction.Y * r.Direction.Y);
         r.Velocity = new Point(DEFINE.Round(tbVelocity.Value * (speedMoveBase * r.Direction.X / sizeDir)),
                                -1 * DEFINE.Round(tbVelocity.Value * (speedMoveBase * r.Direction.Y / sizeDir)));
         timer1.Interval = 30;
         animation       = DEFINE.EAnimation.Running;
         timer1.Start();
         btnStartOrPause.Text   = "Pause";
         btnClearOrStop.Text    = "Stop";
         btnClearOrStop.Enabled = true;
     }
     else if (animation == DEFINE.EAnimation.Running)
     {
         animation            = DEFINE.EAnimation.Pause;
         btnStartOrPause.Text = "Resume";
     }
     else if (animation == DEFINE.EAnimation.Pause)
     {
         animation            = DEFINE.EAnimation.Running;
         btnStartOrPause.Text = "Pause";
     }
 }
Ejemplo n.º 3
0
 private void btnStartOrPause_Click(object sender, EventArgs e)
 {
     if (animation == DEFINE.EAnimation.Start)
     {
         timer1.Interval = 30;
         animation       = DEFINE.EAnimation.Running;
         timer1.Start();
         btnStartOrPause.Text   = "Pause";
         btnClearOrStop.Text    = "Stop";
         btnClearOrStop.Enabled = true;
     }
     else if (animation == DEFINE.EAnimation.Running)
     {
         animation            = DEFINE.EAnimation.Pause;
         btnStartOrPause.Text = "Resume";
     }
     else if (animation == DEFINE.EAnimation.Pause)
     {
         animation            = DEFINE.EAnimation.Running;
         btnStartOrPause.Text = "Pause";
     }
 }
Ejemplo n.º 4
0
        private void btnClearOrStop_Click(object sender, EventArgs e)
        {
            if (animation == DEFINE.EAnimation.Stop)
            {
                // xoa
                r.Erase();
                Oxy.Erase();
                r = new Model.Rectangle(ref bm)
                {
                    Position  = new Point(Oxy.Position.X, Oxy.Position.Y),
                    Color     = Color.Red,
                    Direction = new Point(100, 0),
                    Height    = 60,
                    Width     = 30,
                    Velocity  = new Point(speedMoveBase * tbVelocity.Value, 0)
                };
                r.Draw();
                Oxy.Draw();
                pbDraw.Image = bm;

                animation               = DEFINE.EAnimation.Start;
                btnStartOrPause.Text    = "Start";
                btnClearOrStop.Text     = "Stop";
                btnClearOrStop.Enabled  = false;
                btnStartOrPause.Enabled = true;
                pnlAlpha.Enabled        = true;
                tbAlpha.Value           = 0;
                tbVelocity.Value        = 1;
            }
            if (animation == DEFINE.EAnimation.Running || animation == DEFINE.EAnimation.Pause)
            {
                animation               = DEFINE.EAnimation.Stop;
                btnClearOrStop.Text     = "Clear";
                btnStartOrPause.Enabled = false;
            }
        }
Ejemplo n.º 5
0
 private void btnClearOrStop_Click(object sender, EventArgs e)
 {
     if (animation == DEFINE.EAnimation.Stop)
     {
         if (EChoose == DEFINE.EChooseCircleMove.CircleTranslate)
         {
             // xoa
             c.Erase();
             pbDraw.Image = bm;
             c            = new Model.Circle(ref bm)
             {
                 Color    = Color.Red,
                 Radius   = 50,
                 Velocity = new Point(tbSpeed.Value, tbSpeed.Value),
                 Position = new Point(200, 200)
             };
         }
         else if (EChoose == DEFINE.EChooseCircleMove.CircleRotate)
         {
             //pbDraw.Image = null;
             //bm = new Bitmap(this.pbDraw.Size.Width, this.pbDraw.Size.Height);
             c.Erase();
             l.Erase();
             trajector.Erase();
             pbDraw.Image = bm;
             c            = new Model.Circle(ref bm)
             {
                 Color    = Color.Red,
                 Radius   = 50,
                 Velocity = new Point(tbSpeed.Value, tbSpeed.Value),
                 Position = new Point(200, 200)
             };
             l = new Model.Line(ref bm)
             {
                 Color    = Color.Red,
                 PHead    = new Point(pI.X, pI.Y),
                 PEnd     = new Point(200, 200),
                 Velocity = new Point(tbSpeed.Value, tbSpeed.Value),
             };
         }
         animation               = DEFINE.EAnimation.Start;
         btnStartOrPause.Text    = "Start";
         btnClearOrStop.Text     = "Stop";
         btnClearOrStop.Enabled  = false;
         btnStartOrPause.Enabled = true;
         btnRotate.Enabled       = true;
         btnTranslate.Enabled    = true;
         if (EChoose == DEFINE.EChooseCircleMove.CircleTranslate)
         {
             c.Draw();
         }
         if (EChoose == DEFINE.EChooseCircleMove.CircleRotate)
         {
             c.Draw();
             l.Draw();
             trajector.Draw();
         }
         pbDraw.Image = bm;
     }
     if (animation == DEFINE.EAnimation.Running || animation == DEFINE.EAnimation.Pause)
     {
         animation               = DEFINE.EAnimation.Stop;
         btnClearOrStop.Text     = "Clear";
         btnStartOrPause.Enabled = false;
     }
 }