Exemplo n.º 1
0
 void canvas_MouseMove(object sender, MouseEventArgs e)
 {
     if (isMouseDown)
     {
         Point point = e.GetPosition(canvas);
         Mouse.SetCursor(curAnchorPoint.Cursor);
         double curX, curY;
         if (Cursors.SizeNS == curAnchorPoint.Cursor)
         {
             curX = curAnchorPoint.X;
             curY = point.Y;
             MoveLines(curX, curY);
             MoveAnchorPoint(curX, curY);
             curAnchorPoint.Move(curX, curY);
         }
         else if (Cursors.SizeWE == curAnchorPoint.Cursor)
         {
             MoveLines(point.X, curAnchorPoint.Y);
             MoveAnchorPoint(point.X, curAnchorPoint.Y);
             curAnchorPoint.Move(point.X, curAnchorPoint.Y);
         }
         else
         {
             MoveLines(point.X, point.Y);
             MoveAnchorPoint(point.X, point.Y);
             curAnchorPoint.Move(point.X, point.Y);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 移动单个点
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="anchorPoint"></param>
        private void MoveAnchorPoint(double x, double y, AnchorPoint anchorPoint)
        {
            double preX = anchorPoint.X;
            double preY = anchorPoint.Y;

            if (curAnchorPoint.AnchorPointType == AnchorPointType.NS)
            {
                anchorPoint.Move(anchorPoint.X, y);
                MoveRefAnchorPoint(preX, preY, anchorPoint);
            }
            else if (curAnchorPoint.AnchorPointType == AnchorPointType.WE)
            {
                anchorPoint.Move(x, anchorPoint.Y);
                MoveRefAnchorPoint(preX, preY, anchorPoint);
            }
            else
            {
                if (anchorPoint.AnchorPointType == AnchorPointType.NS)
                {
                    anchorPoint.Move(anchorPoint.X, y);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (anchorPoint.AnchorPointType == AnchorPointType.WE)
                {
                    anchorPoint.Move(x, anchorPoint.Y);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.NE)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SE)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NW)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.SW)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SE)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NW)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.SE)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SW)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NE)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.NW)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SW)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NE)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 移动单个点
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="anchorPoint"></param>
        private void MoveAnchorPoint(double x, double y, AnchorPoint anchorPoint)
        {
            double preX = anchorPoint.X;
            double preY = anchorPoint.Y;
            if (curAnchorPoint.AnchorPointType == AnchorPointType.NS)
            {
                anchorPoint.Move(anchorPoint.X, y);
                MoveRefAnchorPoint(preX, preY, anchorPoint);
            }
            else if (curAnchorPoint.AnchorPointType == AnchorPointType.WE)
            {
                anchorPoint.Move(x, anchorPoint.Y);
                MoveRefAnchorPoint(preX, preY, anchorPoint);
            }
            else
            {
                if (anchorPoint.AnchorPointType == AnchorPointType.NS)
                {
                    anchorPoint.Move(anchorPoint.X, y);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (anchorPoint.AnchorPointType == AnchorPointType.WE)
                {
                    anchorPoint.Move(x, anchorPoint.Y);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.NE)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SE)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NW)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.SW)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SE)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NW)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.SE)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SW)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NE)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
                else if (curAnchorPoint.AnchorPointType == AnchorPointType.NW)
                {
                    if (anchorPoint.AnchorPointType == AnchorPointType.SW)
                    {
                        anchorPoint.Move(anchorPoint.X, y);
                    }
                    else if (anchorPoint.AnchorPointType == AnchorPointType.NE)
                    {
                        anchorPoint.Move(x, anchorPoint.Y);
                    }

                    MoveRefAnchorPoint(preX, preY, x, y, anchorPoint);
                    MoveRefAnchorPoint(preX, preY, anchorPoint);
                }
            }
        }