Skip to content

Stretch

Summary

Describes how content is resized to fill its allocated space.

Signature

1
public enum Stretch

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
 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)
         {
         }
     }
 }

Fields

None

Summary

The content preserves its original size.

Signature

1
public static Stretch None;

Return Value

Stretch

Fill

Summary

The content is resized to fill the destination dimensions. The aspect ratio is not preserved.

Signature

1
public static Stretch Fill;

Return Value

Stretch

Uniform

Summary

The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.

Signature

1
public static Stretch Uniform;

Return Value

Stretch

UniformToFill

Summary

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.

Signature

1
public static Stretch UniformToFill;

Return Value

Stretch