示例#1
0
        public override void Resize(BoxHitTest corner, Point delta)
        {
            Debug.Assert(corner != BoxHitTest.AnchorPoint);
            Rectangle origLoc = Location;
            int       top, left, right, bottom = origLoc.Bottom;

            if (((int)corner & ResizePointTopBit) != 0)
            {
                top    = origLoc.Top + delta.Y;
                bottom = origLoc.Bottom;
            }
            else
            {
                bottom = origLoc.Bottom + delta.Y;
                top    = origLoc.Top;
            }
            if (((int)corner & ResizePointLeftBit) != 0)
            {
                left  = origLoc.Left + delta.X;
                right = origLoc.Right;
            }
            else
            {
                right = origLoc.Right + delta.X;
                left  = origLoc.Left;
            }
            Rectangle newLoc = new Rectangle(left, top, right - left, bottom - top);

            Location = newLoc;
        }
示例#2
0
        public override BoxHitTest HitTest(Point p)
        {
            BoxHitTest hitLocation = BoxHitTest.None;

            if (centralAnchor.Contains(p))
            {
                hitLocation = BoxHitTest.AnchorPoint;
            }
            else if (cornerAnchors[0].Contains(p))
            {
                hitLocation = BoxHitTest.ResizePointTL;
            }
            else if (cornerAnchors[1].Contains(p))
            {
                hitLocation = BoxHitTest.ResizePointTR;
            }
            else if (cornerAnchors[2].Contains(p))
            {
                hitLocation = BoxHitTest.ResizePointBL;
            }
            else if (cornerAnchors[3].Contains(p))
            {
                hitLocation = BoxHitTest.ResizePointBR;
            }
            return(hitLocation);
        }
示例#3
0
 abstract public void Resize(BoxHitTest corner, Point delta);
示例#4
0
        public override void Resize(BoxHitTest corner, Point delta)
        {
#if RESIZABLE_ICONIMGS
            throw new NotImplementedException("No support for resizing IconImgs.");
#endif
        }