Button Foreground color text problem
Created at 19 Dec 2024, 17:45
Button Foreground color text problem
19 Dec 2024, 17:45
Hi All,
From today, I am encountering issues with setting the text color of buttons. The foreground color always remains white ( Background works fine). I am attaching the test code I used.
Could you help me?
using System;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(AccessRights = AccessRights.FullAccess)]
public class Bottoni : Indicator
{
// Dichiarazione del bottone
private Button button;
// Dichiarazione degli input per il colore
[Parameter("Button Background Color", DefaultValue = "Red")]
public string ButtonBackgroundColor { get; set; }
[Parameter("Button Text Color", DefaultValue = "White")]
public string ButtonTextColor { get; set; }
protected override void Initialize()
{
// To learn more about cTrader Automate visit our Help Center:
// Creazione del bottone
button = new Button
{
Text = "Click Me!", // Testo del bottone
Width = 150,
Height = 50,
FontSize = 12,
FontWeight = FontWeight.Bold,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Margin = "10 10 10 10",
CornerRadius = 5,
BorderColor = Color.Black,
BorderThickness = new Thickness(2),
BackgroundColor = Color.FromName(ButtonBackgroundColor), // Colore di sfondo
ForegroundColor = Color.FromName(ButtonTextColor) // Colore del testo
};
// Posizionamento del bottone sulla chart
Chart.AddControl(button);
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] =
}
}
}
PanagiotisCharalampous
20 Dec 2024, 06:14
Hi there,
Can you please let us know which version of cTrader do you use?
Best regards,
Panagiotis
@PanagiotisCharalampous