GMap使用(1)getting started

1.下载源码,编译DLL

http://greatmaps.codeplex.com/   

下载Archive,自己新建一个Solution,添加已有工程,分别是archive解压的greatmaps->sourcecode->greatemaps-,其中的

GMap.NET.Core和GMap.NET.WindowsForms的2个。分别生成2个dll。这里下载。

 

2.相应项目添加引用,浏览到这2个DLL

3.在工具箱中添加控件。

在工具箱上,右键“选择项”,在弹出的对话框中 选择“.NET FrameWork组件”,先浏览文件“GMap.NET.WindowsForms.dll”

然后看到“GMapControl”被勾选后,点击确定。

 

4把工具箱中 的GMapControl拖到自己的form中,一般第一个GMap控件名字是gMapControl1

5.第一个程序。

 

 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.68, 120.34);
            

        }

Form1.Designer.cs中的Dispose函数中添加

 this.gMapControl1.Dispose();

posted on 2018-02-05 09:20  legion  阅读(305)  评论(0编辑  收藏  举报

导航