---
id: "P:cAlgo.API.ControlBase.Margin"
kind: "property"
type: "T:cAlgo.API.ControlBase"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/"
---

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

# ControlBase.Margin

Member of [ControlBase](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/index.md).

## Margin

Gets or sets the level of thickness of the margin of the chart control instance. Property value can be set using Thickness, number, or a string new Thickness(5), new Thickness(1, 2, 3, 4), 5, "5", "1 2 3 4".

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

C#:

```csharp
public Thickness Margin {get; set;}
```

Python:

```python
controlBase.Margin: Thickness
```

### Returns

`Thickness` — 

### Examples

C#:

```csharp
var panel = new StackPanel();
panel.AddChild(new Button { Text = "Buy", Margin = new Thickness(5, 5, 5, 0) });
panel.AddChild(new Button { Text = "Sell", Margin = 5 });
Chart.AddControl(panel);
```

Python:

```python
panel = StackPanel()
buyButton = Button()
buyButton.Text = "Buy"
buyButton.Margin = Thickness(5, 5, 5, 0)
sellButton = Button()
sellButton.Text = "Sell"
sellButton.Margin = Thickness(5)
panel.AddChild(buyButton)
panel.AddChild(sellButton)
api.Chart.AddControl(panel)
```

