---
id: "T:cAlgo.API.Stretch"
kind: "enum"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Stretch/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Stretch (enum)

Describes how content is resized to fill its allocated space.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum Stretch
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use shapes stretch property
    public partial class StretchSample : Indicator
    {
        protected override void Initialize()
        {
            var rectangle = new Rectangle
            {
                Stretch = Stretch,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Height = 100,
                Width = 200,
                FillColor = Color.Blue,
                StrokeColor = Color.Red,
                Opacity = 0.7,
            };

            Chart.AddControl(rectangle);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        rectangle = Rectangle()
        rectangle.Stretch = api.Stretch
        rectangle.HorizontalAlignment = HorizontalAlignment.Center
        rectangle.VerticalAlignment = VerticalAlignment.Center
        rectangle.Height = 100
        rectangle.Width = 200
        rectangle.FillColor = Color.Blue
        rectangle.StrokeColor = Color.Red
        rectangle.Opacity = 0.7

        api.Chart.AddControl(rectangle)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "Stretch",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.Stretch",
      "DefaultValue": "Uniform"
    }
  ]
}
```

## Values

- `Stretch.None` — The content preserves its original size.
- `Stretch.Fill` — The content is resized to fill the destination dimensions. The aspect ratio is not preserved.
- `Stretch.Uniform` — The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.
- `Stretch.UniformToFill` — The content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions.

