Beispiel #1
0
        private void MainPB_MouseUp(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
            {
                /*Point draggingVector = e.Location - (PointD)draggingStartedAt;
                 *
                 * //hmpf. Awful, but at least a fun thing to do
                 * System.Reflection.FieldInfo BPosition = typeof(Bolygó).GetField("Hely", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                 * lock (Bolygó.ModifyListElementsLock)
                 * {
                 *  try
                 *  {
                 *      Bolygó.EnterListLockRead();
                 *      foreach (Bolygó b in Bolygó.lista) BPosition.SetValue(b, (PointD)BPosition.GetValue(b) + draggingVector);
                 *  }
                 *  finally
                 *  {
                 *      Bolygó.ExitListLockModify();
                 *  }
                 * }*/
                Bolygó.MoveAll((e.Location - (PointD)leftDraggingStartedAt) / renderScale);
                break;
            }

            case MouseButtons.Right:
            {
                PointD p = (e.Location - (PointD)rightDraggingStartedAt) / (100 * renderScale);
                toAddVel      = p;
                xSpeedTB.Text = p.X.ToString();
                ySpeedTB.Text = p.Y.ToString();
                break;
            }

            case MouseButtons.Middle:
            {
                addBolygó();
                break;
            }
            }
        }
Beispiel #2
0
 private void centerButton_Click(object sender, EventArgs e)
 {
     Bolygó.RemoveSumMomentum();
     Bolygó.MoveAll((Bolygó.GetCoM() * -1) + midPoint);
 }