加载慢可能是后台远程连接服务器所导致,针对该现象:
亲身测试,该方法可行
在加载地图前添加gmapprovider.timeoutms=0;
地图加载完成后添加gmapprovider.timeoutms1000;//或者其他大于1000的数值
代码如下:
GMapProvider.TimeoutMs = 0;//设置timeoutms为零
this.gMapControl.MapProvider = GMapProviders.GoogleChinaMap;
this.gMapControl.MapProvider = GMap.NET.MapProviders.GoogleChinaMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
//this.gMapControl.SetPositionByKeywords("china,harbin");//设置初始中心为china harbin
//设置地图默认语言
GMapProvider.Language = LanguageType.ChineseSimplified;
//this.gMapControl.MapProvider = GMapProvidersExt.AMapProvider.Instance;
//设置控件显示的当前中心位置
this.gMapControl.Position = new PointLatLng(39.9804435664783, 116.345880031586);
//设置控件最大的缩放比例
this.gMapControl.MaxZoom = 24;
//设置控件最小的缩放比例
this.gMapControl.MinZoom =0;
//设置控件当前的缩放比例
this.gMapControl.Zoom =12;
this.gMapControl.ShowCenter = false; //不显示中心十字点
this.gMapControl.DragButton = System.Windows.Forms.MouseButtons.Left; //左键拖拽地图
//this.gMapControl.MouseWheelZoomType = MouseWheelZoomType.MousePositionAndCenter;
this.gMapControl.IsAccessible = false;
GMapProvider.TimeoutMs = 1000;//地图加载完成后设置timeoutms为1000(或者其他大于领零的数值自己尝试0)