Exemplo n.º 1
0
 private void DesignerControl_MouseUp(object sender, MouseEventArgs e)
 {
     if (this.ObjectType == null)
     {
         this.DragObjectFinished();
     }
     else if (this.DragObject != null)
     {
         BaseObject obj2 = this.DragObject.Object;
         if ((this.ObjectSteps == 0) && (this.DragObject.ControlPoints.Length > 1))
         {
             PointF tf  = obj2.ToPointF(obj2.ControlPoints[1]);
             PointF tf2 = obj2.ToPointF(obj2.ControlPoints[0]);
             if (Math.Sqrt((double)(((tf.X - tf2.X) * (tf.X - tf2.X)) + ((tf.Y - tf2.Y) * (tf.Y - tf2.Y)))) > 20.0)
             {
                 this.ObjectSteps++;
             }
         }
         if (this.ObjectSteps != 0)
         {
             this.DragObject.ControlPointIndex = this.ObjectSteps + 1;
         }
         this.ObjectSteps++;
         if (this.ObjectSteps == obj2.InitNum)
         {
             this.DragObjectFinished();
         }
     }
 }
Exemplo n.º 2
0
 private void DesignerControl_MouseMove(object sender, MouseEventArgs e)
 {
     if (this.DragObject != null)
     {
         FormulaArea fa   = this.DragObject.Object.Area;
         float       num  = e.X - this.DragObject.StartPoint.X;
         float       num2 = e.Y - this.DragObject.StartPoint.Y;
         this.InvalidateObject(this.DragObject.Object);
         if (this.DragObject.ControlPointIndex < 0)
         {
             for (int i = 0; i < this.DragObject.Object.ControlPoints.Length; i++)
             {
                 PointF tf = this.DragObject.Object.ToPointF(this.DragObject.ControlPoints[i]);
                 this.DragObject.Object.ControlPoints[i] = this.GetValueFromPos(tf.X + num, tf.Y + num2, ref fa);
             }
         }
         else
         {
             BaseObject obj2 = this.DragObject.Object;
             obj2.ControlPoints[this.DragObject.ControlPointIndex] = this.GetValueFromPos((float)e.X, (float)e.Y, ref fa);
             if (((obj2.InitNum > 0) && (obj2.InitPoints != null)) && (obj2.InSetup && (this.DragObject.ControlPoints.Length > 1)))
             {
                 PointF tf2  = obj2.ToPointF(obj2.ControlPoints[1]);
                 PointF tf3  = obj2.ToPointF(obj2.ControlPoints[0]);
                 float  num4 = (tf2.X - tf3.X) / obj2.InitPoints[1].X;
                 float  num5 = (tf2.Y - tf3.Y) / obj2.InitPoints[1].Y;
                 for (int j = 2; j < obj2.ControlPoints.Length; j++)
                 {
                     obj2.ControlPoints[j] = this.GetValueFromPos(tf3.X + (num4 * obj2.InitPoints[j].X), tf3.Y + (num5 * obj2.InitPoints[j].Y), ref fa);
                 }
             }
         }
         this.InvalidateObject(this.DragObject.Object);
     }
     else
     {
         Cursor cursor = this.Designer.Cursor;
         if (this.GetPointIndex(e.X, e.Y) >= 0)
         {
             this.Designer.Cursor = Cursors.SizeAll;
         }
         else if (this.GetObjectAt(e.X, e.Y) != null)
         {
             this.Designer.Cursor = Cursors.Hand;
         }
         else if (this.ObjectType == null)
         {
             this.Designer.Cursor = cursor;
         }
         else
         {
             this.Designer.Cursor = Cursors.Cross;
         }
     }
 }