Back to Devexpress

MapPolylineBase.StartLineCap Property

windowsforms-devexpress-dot-xtramap-dot-mappolylinebase-6a0fe300.md

latest5.2 KB
Original Source

MapPolylineBase.StartLineCap Property

Returns start cap settings.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public MapLineCap StartLineCap { get; }
vb
Public ReadOnly Property StartLineCap As MapLineCap

Property Value

TypeDescription
MapLineCap

Contains start cap settings.

|

Remarks

Use the StartLineCap property to display a shape at the beginning of a MapPolylineBase descendant. The default cap shape is an arrow. Set the Visible property to true to display the arrow:

csharp
MapSpline spline = new MapSpline() { StrokeWidth = 2, Stroke = System.Drawing.Color.Blue };
spline.Points.AddRange(new GeoPoint[] {
                          new GeoPoint(-6, -4),
                          new GeoPoint(-3, -10),
                          new GeoPoint(-6, -20) });
mapItemStorage1.Items.Add(spline);

MapPolyline polyLine = new MapPolyline() { StrokeWidth = 2, Stroke = System.Drawing.Color.Blue };
polyLine.Points.AddRange(new GeoPoint[] {
                         new GeoPoint(-11, -4),
                         new GeoPoint(-8, -10),
                         new GeoPoint(-11, -20) });
mapItemStorage1.Items.Add(polyLine);

spline.StartLineCap.Visible = true;
polyLine.StartLineCap.Visible = true;
vb
Dim spline As MapSpline = New MapSpline() With {
        .StrokeWidth = 2,
        .Stroke = Drawing.Color.Blue
}
spline.Points.AddRange(New GeoPoint() {New GeoPoint(-6, -4), 
                                       New GeoPoint(-3, -10), 
                                       New GeoPoint(-6, -20)})
mapItemStorage1.Items.Add(spline)

Dim polyLine As MapPolyline = New MapPolyline() With {
        .StrokeWidth = 2,
        .Stroke = Drawing.Color.Blue
}
polyLine.Points.AddRange(New GeoPoint() {New GeoPoint(-11, -4), 
                                         New GeoPoint(-8, -10), 
                                         New GeoPoint(-11, -20)})
mapItemStorage1.Items.Add(polyLine)

spline.StartLineCap.Visible = True
polyLine.StartLineCap.Visible = True

Result:

To display a custom shape, set the MapLineCap.Template property to a MapUnit array that defines a cap template.

Use the MapLineCap.Width and MapLineCap.Length properties to specify dimensions of the default arrow or a custom shape.

The following code defines the start cap template and its dimensions:

csharp
MapUnit[] template = new MapUnit[] {new MapUnit(0, 0),
                                    new MapUnit(-0.5, -0.5),
                                    new MapUnit(0.45, 0),
                                    new MapUnit(-0.5, 0.5),
                                    new MapUnit(0, 0)};
spline.StartLineCap.Template = template;
polyLine.StartLineCap.Template = template;

spline.StartLineCap.Length = 20;
spline.StartLineCap.Width = 20;

polyLine.StartLineCap.Length = 35;
polyLine.StartLineCap.Width = 22;
vb
Dim template As MapUnit() = New MapUnit() {New MapUnit(0, 0), 
                                           New MapUnit(-0.5, -0.5),
                                           New MapUnit(0.45, 0),
                                           New MapUnit(-0.5, 0.5),
                                           New MapUnit(0, 0)}

spline.StartLineCap.Template = template
polyLine.StartLineCap.Template = template

spline.StartLineCap.Length = 20
spline.StartLineCap.Width = 20

polyLine.StartLineCap.Length = 35
polyLine.StartLineCap.Width = 22

Result:

The MapLineCap.IsFilled property specifies whether the cap shape is filled:

csharp
spline.StartLineCap.IsFilled = false;
polyLine.StartLineCap.IsFilled = false;
vb
spline.EndLineCap.IsFilled = False
polyLine.EndLineCap.IsFilled = False

See Also

MapPolylineBase Class

MapPolylineBase Members

DevExpress.XtraMap Namespace