Exemple #1
0
        public void SetRight(double value)
        {
            double moveVector           = value - Right;
            EMoveRectangleDirection dir = EMoveRectangleDirection.Right;

            if (value < Right)
            {
                moveVector = Right - value;
                dir        = EMoveRectangleDirection.Left;
            }
            MoveRectangle(dir, moveVector);
        }
Exemple #2
0
        public void SetBottom(double value)
        {
            double moveVector           = value - Bottom;
            EMoveRectangleDirection dir = EMoveRectangleDirection.Down;

            if (value < Bottom)
            {
                moveVector = Bottom - value;
                dir        = EMoveRectangleDirection.Up;
            }
            MoveRectangle(dir, moveVector);
        }
Exemple #3
0
        public void SetTop(double value)
        {
            double moveVector           = value - Top;
            EMoveRectangleDirection dir = EMoveRectangleDirection.Down;

            if (value < Top)
            {
                moveVector = Top - value;
                dir        = EMoveRectangleDirection.Up;
            }
            MoveRectangle(dir, moveVector);
        }
Exemple #4
0
        public void MoveRectangle(EMoveRectangleDirection inDirection, double inValue = 3)
        {
            Point newPoint = new Point(0, 0);

            if (RectanglePath != null)
            {
                var geometry = RectanglePath.Data as RectangleGeometry;
                if (geometry != null)
                {
                    newPoint = new Point(geometry.Rect.X, geometry.Rect.Y);
                }
            }
            if (inDirection == EMoveRectangleDirection.Up)
            {
                newPoint.Y -= inValue;
            }
            else if (inDirection == EMoveRectangleDirection.Down)
            {
                newPoint.Y += inValue;
            }
            else if (inDirection == EMoveRectangleDirection.Left)
            {
                newPoint.X -= inValue;
            }
            else if (inDirection == EMoveRectangleDirection.Right)
            {
                newPoint.X += inValue;
            }
            else if (inDirection == EMoveRectangleDirection.UpLeft)
            {
                newPoint.X -= inValue;
                newPoint.Y -= inValue;
            }
            else if (inDirection == EMoveRectangleDirection.UpRight)
            {
                newPoint.X += inValue;
                newPoint.Y -= inValue;
            }
            else if (inDirection == EMoveRectangleDirection.DownLeft)
            {
                newPoint.X -= inValue;
                newPoint.Y += inValue;
            }
            else if (inDirection == EMoveRectangleDirection.DownRight)
            {
                newPoint.X += inValue;
                newPoint.Y += inValue;
            }
            UpdateRectanglePosition(newPoint);
        }