Skip to content

Canvas

Summary

Defines an area to position child elements by coordinates relative to the Canvas area.

Signature

1
public class Canvas : Panel

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample indicator shows how to use the Canvas panel
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class CanvasSample : Indicator
     {
         protected override void Initialize()
         {
             var canvas = new Canvas
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 Width = 300,
                 Height = 200,
                 BackgroundColor = Color.Red,
                 Opacity = 0.5
             };
             canvas.AddChild(new Button
             {
                 Top = 20,
                 Left = 80,
                 Margin = 5,
                 Text = "Button Inside Canvas"
             });
             canvas.AddChild(new Image
             {
                 Source = Properties.Resources.stock,
                 Margin = 5,
                 Width = 128,
                 Height = 128,
                 Top = 45,
                 Left = 80
             });
             Chart.AddControl(canvas);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: July 1, 2022

Comments