Question

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.

Was it helpful?

Solution

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;
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top