2012-05-11 31 views
1

我第一次使用GMap,但我的地圖不會顯示...我正在尋找一個工作的C#應用​​程序源。你可以幫我嗎?工作GMap.NET應用程序源

注:我已經下載thishttp://greatmaps.codeplex.comthis文件,但它們只是應用程序,並沒有包括源...

感謝。

+0

greatmaps.net是CodePlex上,因此具有可來源:http://greatmaps.codeplex.com/SourceControl/list/changesets# –

+0

這裏是一個初學者對GMap.NET教程Windows窗體:HTTP: //bit.ly/12RyRT3 –

回答

6

這是gMapControl1的形式就可以了。將Gmap.NET.CoreGmap.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; 
     } 
    } 
} 
+1

謝謝,但是沒有地圖顯示:http://i.stack.imgur.com/JYBnK.png – mrdaliri

+1

抱歉。將'gMapControl.Zoom'設置爲1. – Eugene

+1

WOW!謝謝......但我看到的只是一張世界地圖......它沒有去...... – mrdaliri