Beispiel #1
0
 private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     if (point == null)
     {
         return;
     }
     if (!isOnEdge)
     {
         point.X = e.X;
     }
     if (point.X < State.Boundries.Left)
     {
         point.X = State.Boundries.Left;
     }
     if (point.X > State.Boundries.Right)
     {
         point.X = State.Boundries.Right;
     }
     point.Y = e.Y;
     if (point.Y < State.Boundries.Top)
     {
         point.Y = State.Boundries.Top;
     }
     if (point.Y > State.Boundries.Bottom)
     {
         point.Y = State.Boundries.Bottom;
     }
     point    = null;
     isOnEdge = true;
     pictureBox1.Invalidate();
     State.SelectedCurve.SetValues();
     UpdateOutputImage();
 }
 public BezierCurve(DragablePoint p0, DragablePoint p1, DragablePoint p2, DragablePoint p3)
 {
     Points[0] = p0;
     Points[1] = p1;
     Points[2] = p2;
     Points[3] = p3;
     SetValues();
 }
Beispiel #3
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (point != null)
     {
         return;
     }
     for (int i = 1; i < 4; i++)
     {
         if (State.SelectedCurve.Points[i].IsHit(e.X, e.Y))
         {
             point    = State.SelectedCurve.Points[i];
             isOnEdge = i == 3;
             break;
         }
     }
 }