Back to Devexpress

MapLine.StartLineCap Property

windowsforms-devexpress-dot-xtramap-dot-mapline-ff64a436.md

latest5.5 KB
Original Source

MapLine.StartLineCap Property

Returns MapLine 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 MapLine start cap settings.

|

Remarks

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

csharp
MapLine line = new MapLine() { Point1 = new GeoPoint(-3, -10),
                               Point2 = new GeoPoint(0, 0), 
                               StrokeWidth = 2, 
                               Stroke = System.Drawing.Color.Blue };
mapItemStorage1.Items.Add(line);                              
line.StartLineCap.Visible = true;
vb
Dim line As MapLine = New MapLine() With {
    .Point1 = New GeoPoint(-3, -10),
    .Point2 = New GeoPoint(0, 0),
    .StrokeWidth = 2,
    .Stroke = Drawing.Color.Blue
}
mapItemStorage1.Items.Add(line)
line.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 example defines the start cap template and its dimensions:

csharp
MapLine line = new MapLine() { Point1 = new GeoPoint(-3, -10),
                               Point2 = new GeoPoint(0, 0), 
                               StrokeWidth = 2, 
                               Stroke = System.Drawing.Color.Blue };
mapItemStorage1.Items.Add(line);                               
line.StartLineCap.Visible = true;
line.StartLineCap.Length = 30;
line.StartLineCap.Width = 22;
line.StartLineCap.Template = new MapUnit[] { new MapUnit(0, 0),
                                           new MapUnit(-0.5, -0.5),
                                           new MapUnit(0.25, 0),
                                           new MapUnit(-0.5, 0.5),
                                           new MapUnit(0, 0),
};
vb
Dim line As MapLine = New MapLine() With {
                            .Point1 = New GeoPoint(-3, -10),
                            .Point2 = New GeoPoint(0, 0),
                            .StrokeWidth = 2,
                            .Stroke = Drawing.Color.Blue
}
mapItemStorage1.Items.Add(line)
line.StartLineCap.Visible = True
line.StartLineCap.Length = 30
line.StartLineCap.Width = 22
line.StartLineCap.Template = New MapUnit() {New MapUnit(0, 0), 
                                          New MapUnit(-0.5, -0.5), 
                                          New MapUnit(0.25, 0), 
                                          New MapUnit(-0.5, 0.5), 
                                          New MapUnit(0, 0)}

Result:

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

csharp
line.StartLineCap.IsFilled = false;
vb
line.StartLineCap.IsFilled = False

When map lines are created based on data source values, use the following API members to map data source fields to start cap properties:

For more examples on MapLine cap property mappings, see the demo:

Run Demo: Map Arrows

See Also

EndLineCap

MapLine Class

MapLine Members

DevExpress.XtraMap Namespace