[Obsolote] Documentation Image is obsolte
Created at 14 Aug 2024, 15:44
[Obsolote] Documentation Image is obsolte
14 Aug 2024, 15:44
Here (https://help.ctrader.com/ctrader-algo/references/Controls/Image/?h=image#namespace) the second example is using AccessRight which is obsolte in .net 6 and the first example Properties isn't defined
c#
using cAlgo.API;
using System.IO;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class ImageSample : Indicator
{
[Parameter("Image File Path")]
public string ImageFilePath { get; set; }
protected override void Initialize()
{
if (!File.Exists(ImageFilePath))
{
Print($"Image not found: {ImageFilePath}");
return;
}
var imageBytes = File.ReadAllBytes(ImageFilePath);
var image = new Image
{
Source = imageBytes,
Width = 200,
Height = 200,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
Chart.AddControl(image);
}
public override void Calculate(int index)
{
}
}
}