Summary
The text alignment regarding the anchor point.
Syntax
public sealed enum TextAlignment
Members
Name | Type | Summary |
---|---|---|
Center | Field | Center the text vertically. |
Justify | Field | Justify the text. |
Left | Field | Align the text left. |
Right | Field | Align the text right. |
Example 1
using cAlgo.API; namespace cAlgo { // This sample indicator shows how to use TextAlignment property to align the text [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class TextAlignmentSample : Indicator { [Parameter("Text Alignment", DefaultValue = TextAlignment.Center)] public TextAlignment TextAlignment { get; set; } protected override void Initialize() { var stackPanel = new StackPanel { BackgroundColor = Color.Gold, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Opacity = 0.6, Width = 200 }; stackPanel.AddChild(new TextBlock { Text = "Sample text", TextAlignment = TextAlignment }); Chart.AddControl(stackPanel); } public override void Calculate(int index) { } } }