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

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

# Border (class)

Represents the border.

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 class Border : ControlBase
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // A sample indicator that shows how to use Border chart control
    public partial class BorderSample : Indicator
    {
        protected override void Initialize()
        {
            var border = new Border
            {
                BorderColor = Color.Yellow,
                BorderThickness = 2,
                Opacity = 0.5,
                BackgroundColor = Color.Violet,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Bottom,
                Width = 200,
                Height = 100,
                Margin = 10
            };

            var stackPanel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };

            stackPanel.AddChild(new TextBlock
            {
                Text = "Text",
                Margin = 5,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontWeight = FontWeight.ExtraBold
            });

            stackPanel.AddChild(new Button
            {
                Text = "Button",
                Margin = 5,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontWeight = FontWeight.ExtraBold
            });

            stackPanel.AddChild(new TextBox
            {
                Text = "Type text...",
                Margin = 5,
                HorizontalAlignment = HorizontalAlignment.Center,
                FontWeight = FontWeight.ExtraBold,
                Width = 100
            });

            border.Child = stackPanel;

            Chart.AddControl(border);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        border = Border()
        border.BorderColor = Color.Yellow
        border.BorderThickness = Thickness(2)
        border.Opacity = 0.5
        border.BackgroundColor = Color.Violet
        border.HorizontalAlignment = HorizontalAlignment.Right
        border.VerticalAlignment = VerticalAlignment.Bottom
        border.Width = 200
        border.Height = 100
        border.Margin = Thickness(10)

        stackPanel = StackPanel()
        stackPanel.Orientation = Orientation.Vertical

        textBlock = TextBlock()
        textBlock.Margin = Thickness(5)
        textBlock.Text = "Text"
        textBlock.FontWeight = FontWeight.ExtraBold
        textBlock.HorizontalAlignment = HorizontalAlignment.Center

        stackPanel.AddChild(textBlock)

        button = Button()
        button.Margin = Thickness(5)
        button.Text = "Button"
        button.FontWeight = FontWeight.ExtraBold
        button.HorizontalAlignment = HorizontalAlignment.Center

        stackPanel.AddChild(button)

        textBox = TextBox()
        textBox.Margin = Thickness(5)
        textBox.FontWeight = FontWeight.ExtraBold
        textBox.HorizontalAlignment = HorizontalAlignment.Center
        textBox.Width = 100
        textBox.Text = "Type text..."

        stackPanel.AddChild(textBox)

        border.Child = stackPanel

        api.Chart.AddControl(border)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Constructors

- `public Border()` — Initializes a new instance of the Border class. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Border/Constructor/index.md)

## Properties

- `public Color BackgroundColor {get; set;}` — Gets or sets the color of the border background. 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/Border/BackgroundColor/index.md)
- `public Color BorderColor {get; set;}` — Gets or sets the border line color. 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/Border/BorderColor/index.md)
- `public Thickness BorderThickness {get; set;}` — Gets or sets the border thickness. 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/Border/BorderThickness/index.md)
- `public ControlBase Child {get; set;}` — Gets or sets the border child object. [details](https://help.ctrader.com/ctrader-algo/references/Controls/Border/Child/index.md)
- `public CornerRadius CornerRadius {get; set;}` — Gets or sets the border corner radius. Property value can be set using CornerRadius, number, or a string: new CornerRadius(5), new CornerRadius(1, 2, 3, 4). [details](https://help.ctrader.com/ctrader-algo/references/Controls/Border/CornerRadius/index.md)
- `public Thickness Padding {get; set;}` — Gets or sets the border padding thickness. 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/Border/Padding/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)

