---
id: "M:cAlgo.API.TextBlock.#ctor"
kind: "constructor"
type: "T:cAlgo.API.TextBlock"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/TextBlock/Constructor/"
---

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

# TextBlock constructor

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

## TextBlock()

Initializes a new instance of the Text Block class.

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 TextBlock()
```

Python:

```python
TextBlock()
```

### Examples

C#:

```csharp
var textBlock = new TextBlock { Text = SymbolName + " " + Symbol.Bid, Margin = 10, ForegroundColor = Color.White };
textBlock.HorizontalAlignment = HorizontalAlignment.Left;
textBlock.VerticalAlignment = VerticalAlignment.Top;
Chart.AddControl(textBlock);
```

Python:

```python
textBlock = TextBlock()
textBlock.Text = f"{api.SymbolName} {api.Symbol.Bid}"
textBlock.Margin = Thickness(10)
textBlock.ForegroundColor = Color.White
textBlock.HorizontalAlignment = HorizontalAlignment.Left
textBlock.VerticalAlignment = VerticalAlignment.Top
api.Chart.AddControl(textBlock)
```

