Skip to content

Image

Summary

Represents the image chart control.

Signature

1
public class Image : ControlBase

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
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use image control to show images
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class ImageSample : Indicator
     {
         protected override void Initialize()
         {
             var image = new Image
             {
                 // Logo is an icon file inside project resources
                 Source = Properties.Resources.Logo,
                 Width = 200,
                 Height = 200,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
             };
             Chart.AddControl(image);
         }
         public override void Calculate(int index)
         {
         }
     }
 }
 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
 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)
         {
         }
     }
 }

Properties

Source

Summary

Gets or sets the source of the image.

Signature

1
public object Source {get; set;}

Return Value

object

Stretch

Summary

Gets or sets a value that describes how an Image should be stretched to fill the destination rectangle.

Signature

1
public Stretch Stretch {get; set;}

Return Value

Stretch

Related Tutorials

StretchDirection

Summary

Gets or sets a value that indicates how the image is scaled.

Signature

1
public StretchDirection StretchDirection {get; set;}

Return Value

StretchDirection

Related Tutorials