How to get the exact location of a mouseclick on a Gmap..

Topics: Windows Forms
Nov 24, 2012 at 3:17 PM
Edited Nov 24, 2012 at 3:20 PM

I tried to catch the exact location off a mouse click ( right or left click) 

 

Only way I succedd to get out the coordinates is by reposition the map.. this is not what I want to achieve.

 

Private Sub GMap1_OnPositionChanged(ByVal point As GMap.NET.PointLatLng) Handles GMap1.OnPositionChanged      

Txtlat.Text = GMap1.Position.Lat.ToString(CultureInfo.InvariantCulture)      

txtlng.Text = GMap1.Position.Lng.ToString(CultureInfo.InvariantCulture)   

End Sub

Coordinator
Nov 24, 2012 at 3:23 PM

Map.FromLocalToLatLng

Nov 24, 2012 at 4:56 PM

OK, i did like this --works ! - Thank's 

 

Private Sub GMap1_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GMap1.MouseDown   

 Dim marker As New GMapMarkerGoogleGreen(GMap1.FromLocalToLatLng(e.X, e.Y))     

 marker.Position = GMap1.FromLocalToLatLng(e.X, e.Y)       

Txtlat.Text = (marker.Position.Lat.ToString)   

Txtlng.Text = (marker.Position.Lng.ToString)   

End Sub