ControlProperty
enum cAlgo.API
DesktopCLICloud
Represents the Control property enumeration used in Style to get or set a style for a specific property.
Definition
public enum ControlProperty
Namespace: cAlgo.API · Group: Styles
Examples
using cAlgo.API;
namespace cAlgo
{
// This sample shows how to use ControlProperty in control style
public partial class ControlPropertySample : Indicator
{
protected override void Initialize()
{
var style = new Style();
style.Set(ControlProperty.Margin, 5);
style.Set(ControlProperty.ForegroundColor, Color.Blue);
style.Set(ControlProperty.FontSize, 14);
style.Set(ControlProperty.Width, 100);
var textBlock = new TextBlock
{
Text = "Styled Text Block",
Style = style,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
Chart.AddControl(textBlock);
}
public override void Calculate(int index)
{
}
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def initialize(self):
style = Style()
style.Set(ControlProperty.Margin, 5)
style.Set(ControlProperty.ForegroundColor, Color.Blue)
style.Set(ControlProperty.FontSize, 14)
style.Set(ControlProperty.Width, 100)
textBlock = TextBlock()
textBlock.Text = "Styled Text Block"
textBlock.Style = style
textBlock.HorizontalAlignment = HorizontalAlignment.Center
textBlock.VerticalAlignment = VerticalAlignment.Center
api.Chart.AddControl(textBlock)
{
"AccessRights": "None",
"TimeZone": "UTC",
"IsOverlay": true
}
Values
| Name | Value | Description |
|---|---|---|
BackgroundColor | 0 | The background color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000". |
ForegroundColor | 1 | The foreground color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000". |
Opacity | 2 | The opacity of the control. 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. |
MinWidth | 3 | The minimum width of the control. |
MaxWidth | 4 | The maximum width of the control. |
MinHeight | 5 | The minimum hight of the control. |
MaxHeight | 6 | The maximum hight of the control. |
Width | 7 | The width of the control. |
Height | 8 | The height of the control. |
Padding | 9 | The padding of the control. 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". |
BorderThickness | 10 | The thickness of the border of the control. 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". |
CornerRadius | 11 | The radius of the corner of the control. Property value can be set using CornerRadius, number, or a string: new CornerRadius(5), new CornerRadius(1, 2, 3, 4). |
HorizontalContentAlignment | 12 | The horizontal content alignment. |
VerticalContentAlignment | 13 | The vertical content alignment. |
TextAlignment | 14 | The alignment of the content. |
Margin | 15 | The margin of the content. 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". |
FontWeight | 16 | The content font weight. Property value can be set using the FontWeight enumerations: FontWeight.Bold, FontWeight.SemiBold, FontWeight.Light, FontWeight.Thin, etc. |
FontStyle | 17 | The content font style. Property value can be set using the FontStyle enumeration: FontWeight.Italic or FontWeight.Oblique. |
FontFamily | 18 | The font family. |
FontSize | 19 | The font size. |
BorderColor | 20 | The border color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000". |
CaretColor | 21 | The caret color. Property value can be set using color values, or use the strings Color.Red, Color.FromName("Red"), Color.FromArgb(255, 0, 0), Color.FromHex("#ff0000"), "Red", "#ff0000". |