# Sandbox.Rect.Contain

```csharp
Rect Contain(in Vector2 size, TextFlag align = 132, bool stretch = False)
```

Contain a given rectangle (image) within this rectangle (frame), preserving aspect ratio.

### Parameters

- `in size` (`Vector2`): Size of the rectagle (image) to try to contain within this frame rectangle.
- `align` (`TextFlag`), default `132`: Where to align the given box within this rectangle.
- `stretch` (`bool`), default `False`: Whether to stretch the given rectagle (image) should its size be smaller than largest rectagle (image) size possible within this rectangle (frame).

### Returns

`Rect`: A rectangle with correct position and size to fit within the "parent" rectangle.

Declared in [Sandbox.Rect](/api/Sandbox.Rect).
Assembly: `Sandbox.System`.
