How to add markers? (pushpin, placemark, or any that can mark a position)

Topics: Windows Forms
Jul 28, 2011 at 8:53 AM

Hi Guys,

Been struggling with this one due to lack of documentation. I have tried many ways to add a marker on a windows forms, but the marker does not display. What is the simplest way of adding a marker with description and a tooltip?

Any suggestions are appreciated.



Jul 28, 2011 at 10:19 AM

tried look in demo source? ;}

Jul 29, 2011 at 5:03 PM

Try this...the code is in VB since most of the request here is in VB

  	'Init the map control
	With map
            .MapType = MapType.BingMap
            .MinZoom = 3
            .MaxZoom = 17
            .Zoom = 4
            .Manager.Mode = AccessMode.ServerAndCache
        End With

	'Load a marker(s)
	'First is to create an overlay
	Dim overlayOne As New GMapOverlay(map, "OverlayOne")
	'Create a marker and add it to the overlay (overlayOne)
	overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(LatitudeValue, LongitudeValue)))
        'If you wanted to add multiple markers then you can do so via a loop, e.g.
        'For Each customer In Customers
        '       overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(customer.Lat, customer.Long)))

        'Add the overlay to the map control