Skip to content

Shape

class cAlgo.API

DesktopCLICloud

Provides the base class for shape elements, such as Ellipse, Polygon, and Rectangle.

Environment behaviour

CLI — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Cloud — not supported. Accepted without error but never displayed, so control events such as Click are never raised.

Definition

public abstract class Shape : ControlBase

Namespace: cAlgo.API · Group: Shapes · Inherits: ControlBase

Examples

var canvas = new Canvas { Width = 300, Height = 120 };
var shapes = new Shape[]
{
    new Rectangle { Width = 80, Height = 40, Left = 10, Top = 10, FillColor = Color.SteelBlue },
    new Ellipse { Width = 40, Height = 40, Left = 110, Top = 10, FillColor = Color.Orange },
    new Line { X1 = 170, Y1 = 30, X2 = 280, Y2 = 30, StrokeColor = Color.White }
};
foreach (var shape in shapes)
{
    shape.StrokeThickness = 2;
    canvas.AddChild(shape);
}
Chart.AddControl(canvas);
canvas = Canvas()
canvas.Width = 300
canvas.Height = 120
rectangle = Rectangle()
rectangle.Width = 80
rectangle.Height = 40
rectangle.FillColor = Color.SteelBlue
ellipse = Ellipse()
ellipse.Width = 40
ellipse.Height = 40
ellipse.Left = 110
ellipse.FillColor = Color.Orange
for shape in [rectangle, ellipse]:
    shape.StrokeThickness = 2
    canvas.AddChild(shape)
api.Chart.AddControl(canvas)

Properties

Name Description
FillColorDesktopCLICloudColor Gets or sets the fill color.
StretchDesktopCLICloudStretch Gets or sets the stretch value.
StrokeColorDesktopCLICloudColor Gets or sets the stroke color.
StrokeDashArrayDesktopCLIClouddouble[] Gets or sets a collection of Double values that indicate the pattern of dashes and gaps that is used to outline shapes.
StrokeDashCapDesktopCLICloudPenLineCap Gets or sets a PenLineCap enumeration value that specifies how the ends of a dash are drawn.
StrokeDashOffsetDesktopCLIClouddouble Gets or sets a Double that specifies the distance within the dash pattern where a dash begins.
StrokeEndLineCapDesktopCLICloudPenLineCap Gets or sets the shape at the end of a line.
StrokeLineJoinDesktopCLICloudPenLineJoin Gets or sets the shape that joins two lines.
StrokeMiterLimitDesktopCLIClouddouble Gets or sets a limit on the ratio of the miter length to half the StrokeThickness of a Shape element.
StrokeStartLineCapDesktopCLICloudPenLineCap Gets or sets the shape at the beginning of a line.
StrokeThicknessDesktopCLIClouddouble Gets or sets the stroke thickness.

Inherited members

From ControlBase: ResetProperty, UniqueId, Style, Left, Top, Right, Bottom, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, IsEnabled, IsVisible, Opacity, Margin, VerticalAlignment, HorizontalAlignment, Dock, IsHitTestVisible

See also