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);//成都 }