Ejemplo n.º 1
0
        private void PrintObject1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (MouseOverType == 0)
                {
                    int offsetX = e.X - p.X;
                    int offsetY = e.Y - p.Y;
                    select.OffSetX(offsetX);
                    select.OffSetY(offsetY);
                }
                else if (MouseOverType == 1)
                {
                    int offsetX = e.X - p.X;
                    select.OffSetX(offsetX);
                    select.OffSetWidth(-1 * offsetX);
                }
                else if (MouseOverType == 2)
                {
                    int offsetX = e.X - p.X;
                    select.OffSetWidth(offsetX);
                    p = new Point(e.X, p.Y);
                }
                else if (MouseOverType == 3)
                {
                    int offsetY = e.Y - p.Y;
                    select.OffSetY(offsetY);
                    select.OffSetHeight(-1 * offsetY);
                }
                else if (MouseOverType == 4)
                {
                    int offsetY = e.Y - p.Y;
                    select.OffSetHeight(offsetY);
                    p = new Point(p.X, e.Y);
                }
                else if (MouseOverType == 5)
                {
                    int offsetX = e.X - p.X;
                    int offsetY = e.Y - p.Y;
                    select.OffSetX(offsetX);
                    select.OffSetY(offsetY);
                    select.OffSetWidth(-1 * offsetX);
                    select.OffSetHeight(-1 * offsetY);
                }
                else if (MouseOverType == 6)
                {
                    int offsetX = e.X - p.X;
                    int offsetY = e.Y - p.Y;
                    select.OffSetY(offsetY);
                    select.OffSetWidth(offsetX);
                    select.OffSetHeight(-1 * offsetY);
                    p = new Point(e.X, p.Y);
                }
                else if (MouseOverType == 7)
                {
                    int offsetX = e.X - p.X;
                    int offsetY = e.Y - p.Y;
                    select.OffSetX(offsetX);

                    select.OffSetWidth(-1 * offsetX);
                    select.OffSetHeight(offsetY);
                    p = new Point(p.X, e.Y);
                }
                else if (MouseOverType == 8)
                {
                    int offsetX = e.X - p.X;
                    int offsetY = e.Y - p.Y;

                    select.OffSetWidth(offsetX);
                    select.OffSetHeight(offsetY);
                    p = new Point(e.X, e.Y);
                }
            }
            else
            {
                var MouseOverType = Helper.PrintObjectHelper.MouseOverType(new Point(e.X, e.Y), con);
                con.Cursor = Helper.PrintObjectHelper.GetCursor(MouseOverType);
            }
        }