Exemplo n.º 1
0
 public static bool Contains(int x, int y, Point[] pointArray)
 {
     return(HitTest.Contains(new Point(x, y), pointArray));
 }
        public void UpdateDestinationSide()
        {
            Rectangle rectangle;

            if (this.DestinationType == PlotDragType.Group)
            {
                PlotLayoutBlockGroup plotLayoutBlockGroup = this.Destination as PlotLayoutBlockGroup;
                rectangle = plotLayoutBlockGroup.InnerRectangleLayout;
                Point[] array = new Point[3];
                Point   point = new Point((rectangle.Left + rectangle.Right) / 2, (rectangle.Top + rectangle.Bottom) / 2);
                array[0] = new Point(rectangle.Left, rectangle.Top);
                array[1] = point;
                array[2] = new Point(rectangle.Left, rectangle.Bottom);
                if (HitTest.Contains(this.MousePoint, array))
                {
                    this.DestinationRect            = new Rectangle(rectangle.Left - 10, rectangle.Top, 21, rectangle.Height);
                    this.DestinationSide            = PlotDragSide.Left;
                    this.Destination.List           = plotLayoutBlockGroup.ListLeft;
                    this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                }
                else
                {
                    array[0] = new Point(rectangle.Right, rectangle.Top);
                    array[1] = point;
                    array[2] = new Point(rectangle.Right, rectangle.Bottom);
                    if (HitTest.Contains(this.MousePoint, array))
                    {
                        this.DestinationRect            = new Rectangle(rectangle.Right - 10, rectangle.Top, 21, rectangle.Height);
                        this.DestinationSide            = PlotDragSide.Right;
                        this.Destination.List           = plotLayoutBlockGroup.ListRight;
                        this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                    }
                    else
                    {
                        array[0] = new Point(rectangle.Left, rectangle.Top);
                        array[1] = point;
                        array[2] = new Point(rectangle.Right, rectangle.Top);
                        if (HitTest.Contains(this.MousePoint, array))
                        {
                            this.DestinationRect            = new Rectangle(rectangle.Left, rectangle.Top - 10, rectangle.Width, 21);
                            this.DestinationSide            = PlotDragSide.Top;
                            this.Destination.List           = plotLayoutBlockGroup.ListTop;
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                        }
                        else
                        {
                            this.DestinationRect            = new Rectangle(rectangle.Left, rectangle.Bottom - 10, rectangle.Width, 21);
                            this.DestinationSide            = PlotDragSide.Bottom;
                            this.Destination.List           = plotLayoutBlockGroup.ListBottom;
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                        }
                    }
                }
            }
            else
            {
                rectangle = this.Destination.BoundsLayout;
                iRectangle iRectangle = new iRectangle(rectangle);
                if (this.Destination.Object != null && !this.Destination.Object.DockHorizontal)
                {
                    iRectangle.Height /= 3;
                    if (iRectangle.Rectangle.Contains(this.MousePoint))
                    {
                        rectangle.Offset(0, -10);
                        this.DestinationRect = rectangle;
                        this.DestinationSide = PlotDragSide.Top;
                        if (this.Destination.Object.DockTop)
                        {
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher;
                        }
                        else
                        {
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                        }
                    }
                    else
                    {
                        iRectangle.OffsetY(7);
                        if (iRectangle.Rectangle.Contains(this.MousePoint))
                        {
                            this.DestinationRect            = rectangle;
                            this.DestinationSide            = PlotDragSide.Stack;
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Same;
                        }
                        else
                        {
                            rectangle.Offset(0, 10);
                            this.DestinationRect = rectangle;
                            this.DestinationSide = PlotDragSide.Bottom;
                            if (this.Destination.Object.DockTop)
                            {
                                this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                            }
                            else
                            {
                                this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher;
                            }
                        }
                    }
                }
                else
                {
                    iRectangle.Width /= 3;
                    if (iRectangle.Rectangle.Contains(this.MousePoint))
                    {
                        rectangle.Offset(-10, 0);
                        this.DestinationRect = rectangle;
                        this.DestinationSide = PlotDragSide.Left;
                        if (this.Destination.Object.DockLeft)
                        {
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher;
                        }
                        else
                        {
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                        }
                    }
                    else
                    {
                        iRectangle.OffsetX(7);
                        if (iRectangle.Rectangle.Contains(this.MousePoint))
                        {
                            this.DestinationRect            = rectangle;
                            this.DestinationSide            = PlotDragSide.Stack;
                            this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Same;
                        }
                        else
                        {
                            rectangle.Offset(10, 0);
                            this.DestinationRect = rectangle;
                            this.DestinationSide = PlotDragSide.Right;
                            if (this.Destination.Object != null && !this.Destination.Object.DockLeft)
                            {
                                this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Higher;
                            }
                            else
                            {
                                this.DestinationDockOrderOffset = PlotDragDockOrderOffset.Lower;
                            }
                        }
                    }
                }
            }
        }