Пример #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            textBoxKineticEnergy.Text   = physicalObject.KineticEnergy.ToString() + " J";
            textBoxPotentialEnergy.Text = physicalObject.PotentialEnergy.ToString() + " J";
            textBoxMechanicEnergy.Text  = (physicalObject.MechanicEnergy).ToString() + " J";

            numericUpDownVolume.Value = (decimal)physicalObject.Volume;
            numericUpDownMass.Value   = (decimal)physicalObject.Mass;
            numericUpDownSpeed.Value  = (decimal)physicalObject.Speed.Value;

            energyChart.addSeriesValues(physicalObject.KineticEnergy, physicalObject.PotentialEnergy, physicalObject.MechanicEnergy);

            physicalObject.Tick();

            if (applyingForce)
            {
                forcePen.Width = 16 + (float)Convertor.GetDistance(physicalObject.Location, mousePosition) * 0.03f;
            }

            this.Refresh();
        }
Пример #2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            propertiesForm.Controls["textBoxKineticEnergy"].Text   = physicalObject.KineticEnergy.ToString();
            propertiesForm.Controls["textBoxPotentialEnergy"].Text = physicalObject.PotentialEnergy.ToString();
            propertiesForm.Controls["textBoxMechanicEnergy"].Text  = physicalObject.MechanicEnergy.ToString();

            ((NumericUpDown)propertiesForm.Controls["numericUpDownVolume"]).Value = (decimal)physicalObject.Volume;
            ((NumericUpDown)propertiesForm.Controls["numericUpDownMass"]).Value   = (decimal)physicalObject.Mass;
            propertiesForm.Controls["textBoxSpeed"].Text = physicalObject.Speed.Value.ToString();
            propertiesForm.Controls["textBoxForce"].Text = physicalObject.Force.Value.ToString();

            energyChart.addSeriesValues(physicalObject.KineticEnergy, physicalObject.PotentialEnergy, physicalObject.MechanicEnergy);

            physicalObject.Tick();

            if (applyingForce)
            {
                forcePen.Width = 16 + (float)Convertor.GetDistance(physicalObject.Location, mousePosition) * 0.03f;
            }

            this.Refresh();
        }