private void timer_Tick(object sender, EventArgs e)
        {
            if (isMouseDown)
            {
                positionOld     = positionCurrent;
                positionCurrent = PointToClient(Cursor.Position);

                if (positionCurrent != positionOld)
                {
                    SelectionRectangle = CaptureHelpers.FixRectangle(positionOnClick.X, positionOnClick.Y,
                                                                     positionCurrent.X - positionOnClick.X + 1, positionCurrent.Y - positionOnClick.Y + 1);
                    Refresh();
                }
            }
        }
Ejemplo n.º 3
0
        private void Crop_MouseMove(object sender, MouseEventArgs e)
        {
            IsAreaIntersect();

            if (IsMoving)
            {
                Rectangle rect = CurrentArea.Rectangle;
                rect.X               += e.X - positionOnClick.X;
                rect.Y               += e.Y - positionOnClick.Y;
                positionOnClick       = e.Location;
                CurrentArea.Rectangle = rect;
                Resize.Update();
            }

            if (IsMouseDown && CurrentArea != null && !CurrentArea.Selected)
            {
                currentPosition = GetMousePosition();
                Rectangle rect = new Rectangle(positionOnClick.X, positionOnClick.Y, currentPosition.X - positionOnClick.X, currentPosition.Y - positionOnClick.Y);
                CurrentArea.Rectangle = CaptureHelpers.FixRectangle(rect);
            }
        }
Ejemplo n.º 4
0
        public void Update()
        {
            if (Visible && nodes != null)
            {
                if (InputManager.IsMouseDown(MouseButtons.Left))
                {
                    for (int i = 0; i < 8; i++)
                    {
                        if (nodes[i].IsDragging)
                        {
                            IsResizing = true;

                            if (!InputManager.IsBeforeMouseDown(MouseButtons.Left))
                            {
                                tempRect = areaManager.CurrentArea;
                            }

                            NodePosition nodePosition = (NodePosition)i;

                            int x = InputManager.MouseVelocity.X;

                            switch (nodePosition)
                            {
                            case NodePosition.TopLeft:
                            case NodePosition.Left:
                            case NodePosition.BottomLeft:
                                tempRect.X     += x;
                                tempRect.Width -= x;
                                break;

                            case NodePosition.TopRight:
                            case NodePosition.Right:
                            case NodePosition.BottomRight:
                                tempRect.Width += x;
                                break;
                            }

                            int y = InputManager.MouseVelocity.Y;

                            switch (nodePosition)
                            {
                            case NodePosition.TopLeft:
                            case NodePosition.Top:
                            case NodePosition.TopRight:
                                tempRect.Y      += y;
                                tempRect.Height -= y;
                                break;

                            case NodePosition.BottomLeft:
                            case NodePosition.Bottom:
                            case NodePosition.BottomRight:
                                tempRect.Height += y;
                                break;
                            }

                            areaManager.CurrentArea = CaptureHelpers.FixRectangle(tempRect);

                            break;
                        }
                    }
                }
                else
                {
                    IsResizing = false;
                }

                UpdateNodePositions();
            }
        }
Ejemplo n.º 5
0
        public void Update()
        {
            BaseShape shape = shapeManager.CurrentShape;

            if (shape != null && Visible && nodes != null)
            {
                if (InputManager.IsMouseDown(MouseButtons.Left))
                {
                    if (shape.NodeType == NodeType.Rectangle)
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            if (nodes[i].IsDragging)
                            {
                                IsResizing = true;

                                if (!InputManager.IsBeforeMouseDown(MouseButtons.Left))
                                {
                                    tempRect = shape.Rectangle;
                                }

                                NodePosition nodePosition = (NodePosition)i;

                                int x = InputManager.MouseVelocity.X;

                                switch (nodePosition)
                                {
                                case NodePosition.TopLeft:
                                case NodePosition.Left:
                                case NodePosition.BottomLeft:
                                    tempRect.X     += x;
                                    tempRect.Width -= x;
                                    break;

                                case NodePosition.TopRight:
                                case NodePosition.Right:
                                case NodePosition.BottomRight:
                                    tempRect.Width += x;
                                    break;
                                }

                                int y = InputManager.MouseVelocity.Y;

                                switch (nodePosition)
                                {
                                case NodePosition.TopLeft:
                                case NodePosition.Top:
                                case NodePosition.TopRight:
                                    tempRect.Y      += y;
                                    tempRect.Height -= y;
                                    break;

                                case NodePosition.BottomLeft:
                                case NodePosition.Bottom:
                                case NodePosition.BottomRight:
                                    tempRect.Height += y;
                                    break;
                                }

                                shape.Rectangle = CaptureHelpers.FixRectangle(tempRect);

                                break;
                            }
                        }
                    }
                    else if (shape.NodeType == NodeType.Line)
                    {
                        if (nodes[(int)NodePosition.TopLeft].IsDragging)
                        {
                            IsResizing = true;

                            shape.StartPosition = new Point(InputManager.MousePosition0Based.X, InputManager.MousePosition0Based.Y);
                        }
                        else if (nodes[(int)NodePosition.BottomRight].IsDragging)
                        {
                            IsResizing = true;

                            shape.EndPosition = new Point(InputManager.MousePosition0Based.X, InputManager.MousePosition0Based.Y);
                        }
                    }
                }
                else
                {
                    IsResizing = false;
                }

                UpdateNodePositions();
            }
        }