public void Resize(PointF point, Shape rs) { for (int i = ShapeList.Count - 1; i >= 0; i--) { Shape shape = ShapeList[i]; RectangleF rectangle = shape.Rectangle; var ResizePoint = shape.GetResizePoint(point); if (ResizePoint != null) { this.ResizePoint = (ShapePoint)ResizePoint; return; } } }
public virtual object GetResizePoint(PointF point) { ShapePoint[] destPoints = new ShapePoint[4] { new ShapePoint("Left Top", new PointF(Rectangle.Left, Rectangle.Top)), new ShapePoint("Right Top", new PointF(Rectangle.Right, Rectangle.Top)), new ShapePoint("Right Bottom", new PointF(Rectangle.Right, Rectangle.Bottom)), new ShapePoint("Left Bottom", new PointF(Rectangle.Left, Rectangle.Bottom)) }; for (int i = 0; i < destPoints.Length; i++) { PointF p = destPoints[i].Point; double distance = GetDistance(p.X, p.Y, point.X, point.Y); if (distance < 10) { return(destPoints[i]); } } return(null); }