2011-07-23 16 views
0

私の問題は、アプリケーションを実行するとフォーム上に何も表示されません。この私のコード:gMapControlで地図を表示するにはどうすればよいですか?

using Gmap.NET.MapProviders; 

を私は似たものを持っていたとして、それはあなたの問題を解決する可能性のあるソフトウェアへ:追加

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
using GMap; 
using GMap.NET; 
using GMap.NET.WindowsForms; 

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


     private void Form1_Load(object sender, EventArgs e1) 
     { 
      try 
      { 
       System.Net.IPHostEntry e = 
        System.Net.Dns.GetHostEntry("www.google.com"); 
      } 
      catch 
      { 
       gMapControl1.Manager.Mode = AccessMode.CacheOnly; 
       MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", 
         "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK, 
         MessageBoxIcon.Warning); 
      } 

      // config map 
      GMaps.Instance.Mode = AccessMode.ServerAndCache; 

      // gMapControl1.CacheLocation = Application.StartupPath + "data.gmdp"; 
      GMaps g = new GMaps(); 



      gMapControl1.MapType = MapType.GoogleSatellite; 
      gMapControl1.MaxZoom = 6; 
      gMapControl1.MinZoom = 1; 
      gMapControl1.Zoom = gMapControl1.MinZoom + 1; 
      gMapControl1.Position = new PointLatLng(54.6961334816182, 
      25.2985095977783); 

      // map events 
      gMapControl1.OnCurrentPositionChanged += new 
      CurrentPositionChanged(gMapControl1_OnCurrentPositionChanged); 
      gMapControl1.OnTileLoadStart += new TileLoadStart(gMapControl1_OnTileLoadStart); 
      gMapControl1.OnTileLoadComplete += new 
      TileLoadComplete(gMapControl1_OnTileLoadComplete); 
      gMapControl1.OnMarkerClick += new MarkerClick(gMapControl1_OnMarkerClick); 
      gMapControl1.OnMapZoomChanged += new MapZoomChanged(gMapControl1_OnMapZoomChanged); 
      gMapControl1.OnMapTypeChanged += new MapTypeChanged(gMapControl1_OnMapTypeChanged); 
      gMapControl1.MouseMove += new MouseEventHandler(gMapControl1_MouseMove); 
      gMapControl1.MouseDown += new MouseEventHandler(gMapControl1_MouseDown); 
      gMapControl1.MouseUp += new MouseEventHandler(gMapControl1_MouseUp); 
      gMapControl1.OnMarkerEnter += new MarkerEnter(gMapControl1_OnMarkerEnter); 
      gMapControl1.OnMarkerLeave += new MarkerLeave(gMapControl1_OnMarkerLeave); 

     } 

     private void gMapControl1_OnCurrentPositionChanged(PointLatLng point) 
     { 

     } 

     private void gMapControl1_OnMarkerLeave(GMapMarker item) 
     { 

     } 

     private void gMapControl1_OnMarkerEnter(GMapMarker item) 
     { 

     } 

     private void gMapControl1_MouseUp(object sender, MouseEventArgs e) 
     { 

     } 

     private void gMapControl1_MouseDown(object sender, MouseEventArgs e) 
     { 

     } 

     private void gMapControl1_MouseMove(object sender, MouseEventArgs e) 
     { 

     } 

     private void gMapControl1_OnMapTypeChanged(MapType type) 
     { 

     } 

     private void gMapControl1_OnMapZoomChanged() 
     { 

     } 

     private void gMapControl1_OnMarkerClick(GMapMarker item, MouseEventArgs e) 
     { 

     } 

     private void gMapControl1_OnTileLoadComplete(long ElapsedMilliseconds) 
     { 

     } 

     private void gMapControl1_OnTileLoadStart() 
     { 

     } 
    } 
} 
+0

私はここで誰もが話すことができませんが、あなたがしようとしていることを説明すると、より良い運を持っているかもしれません。 –

+0

GMap.NET for Windows Formsの初心者向けのチュートリアルです:http://bit.ly/12RyRT3 –

+0

あなたがサンプルコードを提供していれば、できるだけシンプルにしてください。たとえば、空のイベントハンドラを残して – nozzleman

答えて

0

してみてください。 また、Gmap.WindowsForms dllをIDEツールボックスに追加したかどうか確認してください。

関連する問題