0

I am working on gMap.NET and currently I tried to print out the longitude and latitude of a point on the map when user clicks on it.

I have been trying this, as shown in another question Location information where mouse click on the map GMap.net

private void gMapControl_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                double lat = gm1.FromLocalToLatLng(e.X, e.Y).Lat;
                double lng = gm1.FromLocalToLatLng(e.X, e.Y).Lng;
                Console.WriteLine(lat);
                Console.WriteLine(lng);
            }
        }

However, nothing shows up in the console. Does anyone know what should I do?

Thank you

Community
  • 1
  • 1
Hien Tran
  • 1,443
  • 2
  • 12
  • 19

1 Answers1

1

Properties of Mouse_Down in gmap.net.windowsform

    base.OnMouseMove(e);
    Application.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");  
    double X = mapexplr.FromLocalToLatLng(e.X, e.Y).Lng;
    double Y = mapexplr.FromLocalToLatLng(e.X, e.Y).Lat;

    string longitude = X.ToString();
    string latitude = Y.ToString();
    LongStrip.Text = Convert.ToString(Decimal.Parse( longitude,NumberStyles.Currency));
    LatStrip.Text = latitude;
    textBox1.Text = Convert.ToString(double.Parse(longitude, CultureInfo.InvariantCulture));
    textBox2.Text = Convert.ToString(double.Parse(latitude, CultureInfo.InvariantCulture));
ceng
  • 62
  • 12