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; }
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); }
abstract public void Resize(BoxHitTest corner, Point delta);
public override void Resize(BoxHitTest corner, Point delta) { #if RESIZABLE_ICONIMGS throw new NotImplementedException("No support for resizing IconImgs."); #endif }