C# 一个有效的 GMap.NET 应用程序源

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10547147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 14:15:14  来源:igfitidea点击:

a working GMap.NET application source

c#gmap.net

提问by mrdaliri

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?

我第一次使用 GMap,但我的地图不会显示......我正在寻找一个有效的 ac# 应用程序源。你能帮助我吗?

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

注意:我已经从http://greatmaps.codeplex.com下载了这个这个文件,但它们只是应用程序,不包含源代码......

Thanks.

谢谢。

采纳答案by Eugene

Here is form with gMapControl1on it. Add reference on Gmap.NET.Coreand Gmap.NET.WindowsFormsto your project.

这是表格gMapControl1。添加参考Gmap.NET.Core,并Gmap.NET.WindowsForms到项目中。

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