我的Windows窗体上显示的是红色X而不是地图。 [英] A red X is showing on my windows forms instead of a map.

查看:178
本文介绍了我的Windows窗体上显示的是红色X而不是地图。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计们

i一直在尝试研究如何使用C#代码显示地图。

现在问题是我得到了一个很大的RED X我的窗体而不是地图。



thaks



我的尝试:



这是我的代码



hi guys
i have been trying to do a research on how to show maps on using C# code.
now the problem is i am getting a big RED X on my windows form instead of the map.

thaks

What I have tried:

here is my code

try
            {
                gMapControl1.MapProvider =  GMap.NET.MapProviders.BingMapProvider.Instance;
                GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
                gMapControl1.SetPositionByKeywords("Pretoria, South Africa");
               
                gMapControl1.ShowCenter = false;
            }
            catch(Exception ex)
            {
                Console.WriteLine();
                MessageBox.Show(ex.ToString());
            }

推荐答案

试试这个:

Try this:
gmap.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
gmap.SetCurrentPositionByKeywords("Maputo, Mozambique");
gmap.MinZoom = 1;
gmap.MaxZoom = 17;
gmap.Zoom = 5;

另见:GMap.NET初学者教程:|独立软件 [ ^ ]



更新,我测试过Windows 10上的VS2013,GMap 1.7,它工作正常:

Also see: GMap.NET Beginners Tutorial: | Independent Software[^]

Update, I tested with VS2013 on Windows 10, GMap 1.7, and it worked:

using System;
using System.Windows.Forms;

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

        private void Form1_Load(object sender, EventArgs e)
        {
            gMapControl1.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
            //gMapControl1.SetPositionByKeywords("Paris, France");
            gMapControl1.SetPositionByKeywords("Brest, France");
            gMapControl1.MinZoom = 2;
            gMapControl1.MaxZoom = 18;
            gMapControl1.Zoom = 10;
        }
    }
}


这篇关于我的Windows窗体上显示的是红色X而不是地图。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆