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

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

# TextBlock.TextAlignment

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

## TextAlignment

Gets or sets the text alignment.

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 TextAlignment TextAlignment {get; set;}
```

Python:

```python
textBlock.TextAlignment: TextAlignment
```

### Returns

`TextAlignment` — 

### Examples

C#:

```csharp
var textBlock = new TextBlock { Text = "Centered title", Width = 200, TextAlignment = TextAlignment.Center };
Chart.AddControl(textBlock);
```

Python:

```python
textBlock = TextBlock()
textBlock.Text = "Centered title"
textBlock.Width = 200
textBlock.TextAlignment = TextAlignment.Center
api.Chart.AddControl(textBlock)
```

