예제 #1
0
        /// <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
        }
예제 #2
0
 /// <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)));
 }
예제 #3
0
 /// <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)));
 }