Summary
Describes how content is resized to fill its allocated space.
Syntax
public sealed enum Stretch
Members
Name | Type | Summary |
---|---|---|
Fill | Field | The content is resized to fill the destination dimensions. The aspect ratio is not preserved. |
None | Field | The content preserves its original size. |
Uniform | Field | The content is resized to fit in the destination dimensions while it preserves its native aspect ratio. |
UniformToFill | Field | 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. |
Example 1
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) { } } }