/// <summary> /// Insets the rectangle by the specified padding. /// </summary> /// <param name="padding">Padding to inset this rectangle by</param> public void Inset(PaddingF padding) { X += Math.Min(Width, padding.Left); Width -= Math.Min(Width, padding.Horizontal); Y += Math.Min(Height, padding.Top); Height -= Math.Min(Height, padding.Vertical); }
/// <summary> /// Returns a new rectangle that is inset by the specified <paramref name="padding" /> /// </summary> /// <param name="rectangle">Rectangle to inset</param> /// <param name="padding">Padding to inset by</param> /// <returns>A new rectangle inset by the specified padding</returns> public static RectangleF Inset(RectangleF rectangle, PaddingF padding) { rectangle.Inset(padding); return(rectangle); }