a working GMap.NET application source [closed]

那年仲夏 提交于 2019-12-23 02:19:35

问题


I'm using GMap for the first time, but my maps won't show... I'm looking for a working a c# application source. Can you help me?

Note: I've downloaded this and this file from http://greatmaps.codeplex.com, but they are just applications, and no source included...

Thanks.


回答1:


Here is form with gMapControl1 on it. Add reference on Gmap.NET.Core and Gmap.NET.WindowsForms to your project.

using System;
using System.Windows.Forms;
using GMap.NET.MapProviders;
using GMap.NET;

namespace gmap
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //use google provider
            gMapControl1.MapProvider = GoogleMapProvider.Instance;
            //get tiles from server only
            gMapControl1.Manager.Mode = AccessMode.ServerOnly;
            //not use proxy
            GMapProvider.WebProxy = null;
            //center map on moscow
            gMapControl1.Position = new PointLatLng(55.755786121111, 37.617633343333);

            //zoom min/max; default both = 2
            gMapControl1.MinZoom = 1;
            gMapControl1.MaxZoom = 20;
            //set zoom
            gMapControl1.Zoom = 10;
        }
    }
}


来源:https://stackoverflow.com/questions/10547147/a-working-gmap-net-application-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!