简体   繁体   中英

gmap.net can't see the map

i'm using Gmap.net in Windows Form. I've added references to .dll files than dragged GmapControl to the form and added this code

private void Form1_Load(object sender, EventArgs e)
{                        
     gmap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
     GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.CacheOnly;
     gmap.SetCurrentPositionByKeywords("Maputo, Mozambique");
}

and when I runn it it just shows me the bright control with the red cross in the middle, and the blue text in the bottom "Google-map...."

anny suggestions how could i fix it?

Set your zoom level and set access mode to cacheAndServer

private void Form1_load(object sender, EventArgs e)
{
    gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
    gMapControl1.DragButton = MouseButtons.Left;
    GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
    gMapControl1.Position = new PointLatLng(LATITUDE,LONGITUDE);
    gMapControl1.Zoom = 9;
}

Also to note following on from CodeSlinger's Solution you can also set max and min zoom to the Map:

gMapControl.MaxZoom = 15;
gMapControl.MinZoom = 1;

this tends to set a good format for your map :)

try to change the AccessMode to 'ServerOnly'. I hope to be helpful! Regards.

要解决此问题,应将GMap控件的Min Zoom属性设置为Zero。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM