Skip to content

Stretch

Summary

Describes how content is resized to fill its allocated space.

Signature

1
public enum Stretch

Namespace

cAlgo.API

Fields

Name Description
None The content preserves its original size.
Fill The content is resized to fill the destination dimensions. The aspect ratio is not preserved.
Uniform The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.
UniformToFill The content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions.

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
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use shapes stretch property
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class StretchSample : Indicator
     {
         [Parameter("Stretch", DefaultValue = Stretch.Uniform)]
         public Stretch Stretch { get; set; }
         protected override void Initialize()
         {
             var rectangle = new Rectangle
             {
                 Stretch = Stretch,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
                 Height = 100,
                 Width = 200,
                 FillColor = Color.Blue,
                 StrokeColor = Color.Red,
                 Opacity = 0.7,
             };
             Chart.AddControl(rectangle);
         }
         public override void Calculate(int index)
         {
         }
     }
 }

Last update: July 1, 2022

Comments