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

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

# Control (class)

Represents the Chart Control 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.

## Definition

```csharp
public abstract class Control : ControlBase
```

## Examples

C#:

```csharp
var controls = new Control[] { new TextBlock { Text = "Volume" }, new TextBox { Text = "0.01" }, new Button { Text = "Buy" } };
var panel = new StackPanel { Orientation = Orientation.Horizontal };
foreach (var control in controls)
{
    control.FontSize = 13;
    control.FontFamily = "Segoe UI";
    control.Margin = 3;
    panel.AddChild(control);
}
Chart.AddControl(panel);
```

Python:

```python
label = TextBlock()
label.Text = "Volume"
button = Button()
button.Text = "Buy"
panel = StackPanel()
panel.Orientation = Orientation.Horizontal
for control in [label, button]:
    control.FontSize = 13
    control.FontFamily = "Segoe UI"
    panel.AddChild(control)
api.Chart.AddControl(panel)
```

## Properties

- `public Color BackgroundColor {get; set;}` — Gets or sets the color of the chart control background. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/BackgroundColor/index.md)
- `public string FontFamily {get; set;}` — Gets or sets the font family. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontFamily/index.md)
- `public double FontSize {get; set;}` — Gets or sets the font size. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontSize/index.md)
- `public FontStyle FontStyle {get; set;}` — Gets or sets the font style. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontStyle/index.md)
- `public FontWeight FontWeight {get; set;}` — Gets or sets the font weight. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/FontWeight/index.md)
- `public Color ForegroundColor {get; set;}` — Gets or sets the color of the chart control foreground. Check the Color class for the ARGB (alpha, red, green, blue) color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000". [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/ForegroundColor/index.md)
- `public HorizontalAlignment HorizontalContentAlignment {get; set;}` — Gets or sets the horizontal content alignment. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/HorizontalContentAlignment/index.md)
- `public Thickness Padding {get; set;}` — Gets or sets the chart control padding. 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/Control/Padding/index.md)
- `public VerticalAlignment VerticalContentAlignment {get; set;}` — Gets or sets the vertical content alignment. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Control/VerticalContentAlignment/index.md)

## Inherited members

- `public void ResetProperty(ControlProperty property)` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/ResetProperty/index.md)
- `public Guid UniqueId {get;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/UniqueId/index.md)
- `public Style Style {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Style/index.md)
- `public double Left {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Left/index.md)
- `public double Top {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Top/index.md)
- `public double Right {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Right/index.md)
- `public double Bottom {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Bottom/index.md)
- `public double Width {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Width/index.md)
- `public double Height {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Height/index.md)
- `public double MinWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinWidth/index.md)
- `public double MinHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MinHeight/index.md)
- `public double MaxWidth {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxWidth/index.md)
- `public double MaxHeight {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/MaxHeight/index.md)
- `public bool IsEnabled {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsEnabled/index.md)
- `public bool IsVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsVisible/index.md)
- `public double Opacity {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Opacity/index.md)
- `public Thickness Margin {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Margin/index.md)
- `public VerticalAlignment VerticalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/VerticalAlignment/index.md)
- `public HorizontalAlignment HorizontalAlignment {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/HorizontalAlignment/index.md)
- `public Dock Dock {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/Dock/index.md)
- `public bool IsHitTestVisible {get; set;}` (from ControlBase) [details](https://help.ctrader.com/ctrader-algo/references/Controls/ControlBase/IsHitTestVisible/index.md)

