예제 #1
0
        /// <summary>
        /// Inicia la animacion al presionar el label de inicio
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void c_Lstart_Click(object sender, EventArgs e)
        {
            if (running)
            {
                MessageBox.Show("Detenga la simulacion primero!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (!running && c_PBBall.Location.X == 0)
            {
                nt          = new Timer();
                nt.Interval = 100;
                escala      = SCALE;
                nt.Tick    += Nt_Tick;

                if (!(c_TBAngle.Text == "" || c_TBVel.Text == ""))
                {
                    cp = new MovPara(double.Parse(c_TBVel.Text), double.Parse(c_TBAngle.Text), (double)c_CBGrav.SelectedValue);
                    nt.Start();
                    c_LY.Text         = String.Format("{0:0.00} mts", cp.Ymax);
                    c_LX.Text         = String.Format("{0:0.00} mts", cp.Xmax);
                    c_LT.Text         = String.Format("{0:0.00} seg", cp.Secmax);
                    c_LVx.Text        = String.Format("{0:0.00} m/s", cp.Vx());
                    c_PBArrow.Visible = false;
                    running           = true;
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Detiene la animacion y reposiciona el proyectil
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void c_LStop_Click(object sender, EventArgs e)
 {
     secs              = 0;
     escala            = SCALE;
     c_PBBall.Location = new Point(0, (int)CCY(0));
     c_PBArrow.Visible = true;
     cp = null;
     this.Invalidate();
     if (nt != null)
     {
         nt.Stop();
     }
     running = false;
 }