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

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

# Thickness (struct)

Defines the thickness of the frame around the rectangle.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public sealed struct Thickness : ValueType
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use Thickness for defining a chart control margin
    public partial class ThicknessSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.6
            };

            var rectangle = new Rectangle
            {
                StrokeColor = Color.Blue,
                FillColor = Color.Red,
                StrokeThickness = 2,
                Margin = new Thickness(10, 5, 10, 5),
                Width = 300,
                Height = 100,
            };

            stackPanel.AddChild(rectangle);

            Chart.AddControl(stackPanel);
        }

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

Python:

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

from cAlgo.API import *

class Test():
    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.Opacity = 0.6

        rectangle = Rectangle()
        rectangle.StrokeColor = Color.Blue
        rectangle.FillColor = Color.Red
        rectangle.StrokeThickness = 2
        rectangle.Margin = Thickness(10, 5, 10, 5)
        rectangle.Width = 300
        rectangle.Height = 100

        stackPanel.AddChild(rectangle)

        api.Chart.AddControl(stackPanel)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Constructors

- `public Thickness(double left, double top, double right, double bottom)` — Initializes a new instance of the Thickness structure. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Constructor/index.md)
- `public Thickness(double uniformLength)` — Initializes a new instance of the Thickness structure. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Constructor/index.md)

## Properties

- `public double Bottom {get; set;}` — Gets or sets the thickness of the bottom side of the retangle. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Bottom/index.md)
- `public double Left {get; set;}` — Gets or sets the thickness of the left side of the retangle. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Left/index.md)
- `public double Right {get; set;}` — Gets or sets the thickness of the right side of the retangle. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Right/index.md)
- `public double Top {get; set;}` — Gets or sets the thickness of the top side of the retangle. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Thickness/Top/index.md)

