本文介绍了有效的GMap.NET应用程序源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次使用GMap,但是我的地图无法显示...我正在寻找一个可工作的C#应用​​程序源.你能帮我吗?

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?

注意:我已经下载了文件="nofollow"> http://greatmaps.codeplex.com ,但它们只是应用程序,不包含任何源代码...

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

谢谢.

推荐答案

此处是带有gMapControl1的表单.将Gmap.NET.CoreGmap.NET.WindowsForms上的引用添加到您的项目中.

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;
        }
    }
}

这篇关于有效的GMap.NET应用程序源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 17:39