How get 2 points?

Topics: Windows Forms
Oct 11, 2012 at 2:02 PM

Hello! Help me please! I need to get the coordinates (latitude, longitude) of the top left point of the map and the bottom right point of the map. By what properties gmapcontrol I do that?

tb_lat_1.Text = gMapControl1.FromLocalToLatLng(0, gMapControl1.Size.Height).Lat.ToString();
            tb_lng_1.Text = gMapControl1.FromLocalToLatLng(0, gMapControl1.Size.Height).Lng.ToString();

            tb_lat_2.Text = gMapControl1.FromLocalToLatLng(gMapControl1.Size.Width, 0).Lat.ToString();
            tb_lng_2.Text = gMapControl1.FromLocalToLatLng(gMapControl1.Size.Width, 0).Lng.ToString(); 

 

Attempted to do so, but it is wrong.

Hope for your help. Thanks!

Oct 11, 2012 at 2:17 PM
Edited Oct 11, 2012 at 2:18 PM

var p1 = map.FromLocalToLatLng(0, 0);
var p2 = map.FromLocalToLatLng(width, height);

or

var area = map.ViewArea;

Oct 11, 2012 at 2:33 PM
Edited Oct 11, 2012 at 2:33 PM

thanks! you helped me much more!