PenLineCap


Summary

Describes the shape at the end of a line or segment.

Syntax

public sealed enum PenLineCap

Members

NameTypeSummary
Flat FieldA cap that does not extend past the last point of the line. Comparable to no line cap.
Round FieldA semicircle that has a diameter equal to the line thickness.
Square FieldA rectangle that has a height equal to the line thickness and a length equal to half the line thickness.
Triangle FieldAn isosceles right triangle whose base length is equal to the thickness of the line.

Example 1

using cAlgo.API;
namespace cAlgo
{
    // This sample shows how to use the PenLineCap properties of shapes
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PenLineCapSample : Indicator
    {
        [Parameter("Stroke Start Line Cap", DefaultValue = PenLineCap.Flat)]
        public PenLineCap StrokeStartLineCap { get; set; }
        [Parameter("Stroke End Line Cap", DefaultValue = PenLineCap.Flat)]
        public PenLineCap StrokeEndLineCap { get; set; }
        [Parameter("Stroke Dash Cap", DefaultValue = PenLineCap.Flat)]
        public PenLineCap StrokeDashCap { get; set; }
        protected override void Initialize()
        {
            var rectangle = new Rectangle
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                StrokeStartLineCap = StrokeStartLineCap,
                StrokeEndLineCap = StrokeEndLineCap,
                StrokeDashCap = StrokeDashCap,
                StrokeColor = Color.Red,
                StrokeThickness = 4,
                Width = 200,
                Height = 100,
            };
            Chart.AddControl(rectangle);
        }
        public override void Calculate(int index)
        {
        }
    }
}
Reference