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

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

# ControlBase (class)

Represents the base of chart controls.

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.

## Definition

```csharp
public abstract class ControlBase
```

## Examples

C#:

```csharp
var textBlock = new TextBlock { Text = "Spread monitor", Margin = 10, Opacity = 0.8 };
textBlock.HorizontalAlignment = HorizontalAlignment.Right;
textBlock.VerticalAlignment = VerticalAlignment.Top;
Chart.AddControl(textBlock);
Print("Control {0} added", textBlock.UniqueId);
```

Python:

```python
textBlock = TextBlock()
textBlock.Text = "Spread monitor"
textBlock.Margin = Thickness(10)
textBlock.Opacity = 0.8
textBlock.HorizontalAlignment = HorizontalAlignment.Right
textBlock.VerticalAlignment = VerticalAlignment.Top
api.Chart.AddControl(textBlock)
api.Print(f"Control {textBlock.UniqueId} added")
```

## Methods

- `public void ResetProperty(ControlProperty property)` — Sets the property to the default value and removes its privelege over the style. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/ResetProperty/index.md)

## Properties

- `public double Bottom {get; set;}` — Gets or sets the position of the chart control to the bottom of the chart area. Works only when the control is inside the Canvas panel. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Bottom/index.md)
- `public Dock Dock {get; set;}` — Specifies the dock position of the chart control instance. Works only inside the DockPanel. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Dock/index.md)
- `public double Height {get; set;}` — Gets or sets the hight of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Height/index.md)
- `public HorizontalAlignment HorizontalAlignment {get; set;}` — Gets or sets the horizontal alignment of the chart control instance. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/HorizontalAlignment/index.md)
- `public bool IsEnabled {get; set;}` — Gets or sets the value indicating whether this instance of the chart control is enabled. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsEnabled/index.md)
- `public bool IsHitTestVisible {get; set;}` — Gets or sets a value that declares if the chart control instance is visible for the mouse hit testing. If set to false, then the control will not handle any mouse events. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsHitTestVisible/index.md)
- `public bool IsVisible {get; set;}` — Gets or sets the value indicating whether this instance of the chart control instance is visible. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsVisible/index.md)
- `public double Left {get; set;}` — Gets or sets the position of the chart control to the left side of the chart area. Works only when the control is inside the Canvas panel. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Left/index.md)
- `public Thickness Margin {get; set;}` — 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". [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/index.md)
- `public double MaxHeight {get; set;}` — Gets or sets the maximum height of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxHeight/index.md)
- `public double MaxWidth {get; set;}` — Gets or sets the maximum width of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxWidth/index.md)
- `public double MinHeight {get; set;}` — Gets or sets the minimum height of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinHeight/index.md)
- `public double MinWidth {get; set;}` — Gets or sets the minimum width of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinWidth/index.md)
- `public double Opacity {get; set;}` — Gets or sets the level of opacity of the chart control instance. Can be set from 0 (transparent) to 1 (opaque). Values higher than 1 will be set to 1, values below 0 will be set to 0. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Opacity/index.md)
- `public double Right {get; set;}` — Gets or sets the position of the chart control to the rignt side of the chart area. Works only when the control is inside the Canvas panel. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Right/index.md)
- `public Style Style {get; set;}` — Gets or sets the style of a chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Style/index.md)
- `public double Top {get; set;}` — Gets or sets the position of the chart control to the top of the chart area. Works only when the control is inside the Canvas panel. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Top/index.md)
- `public Guid UniqueId {get;}` — Gets the unique identifier of a chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/UniqueId/index.md)
- `public VerticalAlignment VerticalAlignment {get; set;}` — Gets or sets the vertical alignment of the chart control instance. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/VerticalAlignment/index.md)
- `public double Width {get; set;}` — Gets or sets the width of the chart control. [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Width/index.md)

