예제 #1
0
        public static Cursor CursorOnRangeHandler(Rectangle[] hands, Point p)
        {
            RangeHandlerPos pos = InRangeHandler(hands, p);

            switch (pos)
            {
            default:
                return(Cursors.Default);

            case RangeHandlerPos.Left:
            case RangeHandlerPos.Right:
                return(Cursors.SizeWE);

            case RangeHandlerPos.Top:
            case RangeHandlerPos.Bottom:
                return(Cursors.SizeNS);

            case RangeHandlerPos.LeftTop:
            case RangeHandlerPos.RightBottom:
                return(Cursors.SizeNWSE);

            case RangeHandlerPos.RightTop:
            case RangeHandlerPos.LeftBottom:
                return(Cursors.SizeNESW);
            }
        }
예제 #2
0
        public static void UpdateRangeHandlers(Rectangle rect, Rectangle[] hands, RangeHandlerPos pos)
        {
            int hx = rect.Left + rect.Width / 2 - hs - 1;
            int hy = rect.Top + rect.Height / 2 - hs - 1;

            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.LeftTop)
            {
                hands[(int)RangeHandlerPos.LeftTop] = new Rectangle(rect.X - hs - 1, rect.Y - hs - 1, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.LeftBottom)
            {
                hands[(int)RangeHandlerPos.LeftBottom] = new Rectangle(rect.X - hs - 1, rect.Bottom - hs + 1, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.RightTop)
            {
                hands[(int)RangeHandlerPos.RightTop] = new Rectangle(rect.Right - hs + 1, rect.Y - hs - 1, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.RightBottom)
            {
                hands[(int)RangeHandlerPos.RightBottom] = new Rectangle(rect.Right - hs + 1, rect.Bottom - hs + 1, size, size);
            }

            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.Left)
            {
                hands[(int)RangeHandlerPos.Left] = new Rectangle(rect.X - hs - 1, hy, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.Right)
            {
                hands[(int)RangeHandlerPos.Right] = new Rectangle(rect.Right - hs + 1, hy, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.Top)
            {
                hands[(int)RangeHandlerPos.Top] = new Rectangle(hx, rect.Top - hs - 1, size, size);
            }
            if (pos == RangeHandlerPos.None || pos == RangeHandlerPos.Bottom)
            {
                hands[(int)RangeHandlerPos.Bottom] = new Rectangle(hx, rect.Bottom - hs + 1, size, size);
            }
        }