GMap.Net使用(3)之地图添加
--樊渝江
1.在窗口应用程序中添加地图
先在Form中添加GMapControl控件
然后添加如下代码:
private void Form1_Load(object sender, EventArgs e)
{
//指定地图缓存存放路径
this.gMapControl1.CacheLocation = System.Windows.Forms.Application.StartupPath;
//指定地图类型
this.gMapControl1.MapProvider = GMapProviders.GoogleChinaMap;
//地图加载模式(有三种模式)
this.gMapControl1.Manager.Mode = AccessMode.ServerAndCache;
//地图最小比例
this.gMapControl1.MinZoom = 1;
//地图最大比例
this.gMapControl1.MaxZoom = 18;
//当前比例
this.gMapControl1.Zoom = 5;
//不显示中心十字点
this.gMapControl1.ShowCenter = false;
//左键拖拽地图
this.gMapControl1.DragButton = System.Windows.Forms.MouseButtons.Left;
//默认显示地址 经,纬
this.gMapControl1.Position = new PointLatLng(30.67, 104.06);//成都
}