Summary
Represents the button.
Syntax
public class Button : Control
Members
Name | Type | Summary |
---|---|---|
BorderColor | Property | 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". |
BorderThickness | Property | Gets or sets the border thickness. |
Button | Method | Initializes a new instance of the Button class. |
Click | Event | Occurs when the button is clicked. |
Content | Property | Gets or sets the content. |
CornerRadius | Property | 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). |
Text | Property | Gets or sets the text. |
Example 1
using cAlgo.API; using System; using System.Linq; namespace cAlgo { // This sample indicator shows how to use Button control and handle its clicked event [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class ButtonSample : Indicator { protected override void Initialize() { var stackPanel = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, BackgroundColor = Color.Gold, Opacity = 0.7 }; for (int i = 0; i < 5; i++) { var button = new Button { Text = "Button #" + i, Margin = 10 }; button.Click += Button_Click; stackPanel.AddChild(button); } Chart.AddControl(stackPanel); } private void Button_Click(ButtonClickEventArgs obj) { var textSplit = obj.Button.Text.Split(' ').TakeWhile(text => !text.Equals("Clicked", StringComparison.OrdinalIgnoreCase)).ToArray(); obj.Button.Text = string.Join(" ", textSplit) + " Clicked"; } public override void Calculate(int index) { } } }