/// <summary> /// Centers the rectangle on a specific point. /// </summary> /// <param name="rectangle">The rectangle to translate</param> /// <param name="point">The point on which to center the reactangle</param> /// <returns>The new rectangle centered on the specified point</returns> public static RectangleF CenterOn(RectangleF rectangle, PointF point) { PointF center = RectangleFHelper.Center(rectangle); #if !PocketPC rectangle.Offset(point.X - center.X, point.Y - center.Y); return(rectangle); #else return(RectangleFHelper.Offset(rectangle, point.X - center.X, point.Y - center.Y)); #endif }
/// <summary> /// Rotates a rectangle around its center /// </summary> /// <param name="rectangle">The rectangle to apply the rotation</param> /// <param name="angle">The clockwise angle of the rotation</param> /// <returns>The minimum bounding rectangle (MBR) of the rotated rectangle</returns> public static RectangleF Rotate(RectangleF rectangle, float angle) { return(RectangleFHelper.RotateAt(rectangle, angle, RectangleFHelper.Center(rectangle))); }
/// <summary> /// Rotates a rectangle around its center /// </summary> /// <param name="rectangle">The rectangle to apply the rotation</param> /// <param name="angle">The clockwise angle of the rotation</param> /// <returns>The minimum bounding rectangle (MBR) of the rotated rectangle</returns> public static RectangleF Rotate(RectangleF rectangle, Angle angle) { return(RectangleFHelper.RotateAt(rectangle, (float)angle.DecimalDegrees, RectangleFHelper.Center(rectangle))); }