Stretch
enum cAlgo.API
DesktopCLICloud
Describes how content is resized to fill its allocated space.
Definition
public enum Stretch
Namespace: cAlgo.API · Group: Controls
Examples
using cAlgo.API;
namespace cAlgo
{
// This sample shows how to use shapes stretch property
public partial class StretchSample : Indicator
{
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)
{
}
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def initialize(self):
rectangle = Rectangle()
rectangle.Stretch = api.Stretch
rectangle.HorizontalAlignment = HorizontalAlignment.Center
rectangle.VerticalAlignment = VerticalAlignment.Center
rectangle.Height = 100
rectangle.Width = 200
rectangle.FillColor = Color.Blue
rectangle.StrokeColor = Color.Red
rectangle.Opacity = 0.7
api.Chart.AddControl(rectangle)
{
"AccessRights": "None",
"TimeZone": "UTC",
"IsOverlay": true,
"Parameters": [
{
"Name": "Stretch",
"Type": "Enum",
"EnumTypeFullName": "cAlgo.API.Stretch",
"DefaultValue": "Uniform"
}
]
}
Values
| Name | Value | Description |
|---|---|---|
None | 0 | The content preserves its original size. |
Fill | 1 | The content is resized to fill the destination dimensions. The aspect ratio is not preserved. |
Uniform | 2 | The content is resized to fit in the destination dimensions while it preserves its native aspect ratio. |
UniformToFill | 3 | 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. |