ComponentOne Maps for WinForms
Working with Map Control / Adding Markers / Adding Image as Marker
In This Topic
    Adding Image as Marker
    In This Topic

    If you want to show images as markers on a map, you need to use C1.Win.Map.MarkerImageShape class that represents a custom marker shape. The following code can be used to add an image as a marker on a map:

    Dim vl = New C1.Win.Map.VectorLayer()
    C1Map1.Layers.Add(vl)
    
    Dim placemark = New C1.Win.Map.VectorPlacemark()
    placemark.Geometry = New GeoPoint(70, 60)
    vl.Items.Add(placemark)
    
    ' needs set the Shape to MarkerShape.Custom first.
    placemark.Marker.Shape = MarkerShape.[Custom]
    placemark.Marker.Size = New SizeF(40, 40)
    
    ' then set the CustomShape
    Dim shape = New MarkerImageShape()
    placemark.Marker.CustomShape = shape
    
    shape.Image = Image.FromFile("../../office.png")
    
    var vl = new C1.Win.Map.VectorLayer();
    c1Map1.Layers.Add(vl);
    
    var placemark = new C1.Win.Map.VectorPlacemark();
    placemark.Geometry = new GeoPoint(70, 60);
    vl.Items.Add(placemark);
    
    // needs set the Shape to MarkerShape.Custom first.
    placemark.Marker.Shape = MarkerShape.Custom;
    placemark.Marker.Size = new SizeF(40, 40);
    
    // then set the CustomShape
    var shape = new MarkerImageShape();
    placemark.Marker.CustomShape = shape;
    
    shape.Image = Image.FromFile("office.png");
    

    The map with an image as a marker will look similar to the image given below.Map with an image as a marker