資源簡(jiǎn)介
使用GMap控件進(jìn)行開發(fā)時(shí),在地圖層上的GMarkerOverlay的使用例程

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?GMap.NET;
using?GMap.NET.MapProviders;
using?GMap.NET.WindowsForms;
using?GMap.NET.WindowsForms.Markers;
namespace?GMapTest1
{
????public?partial?class?Form1?:?Form
????{
????????public?GMapOverlay?overlay?=?new?GMapOverlay(“WPMarker“);?????????//用于繪制航點(diǎn)的Marker
????????public?Form1()
????????{
????????????InitializeComponent();
????????????this.gMapControl1.CacheLocation?=?System.Windows.Forms.Application.StartupPath;
????????????this.gMapControl1.MapProvider?=?GMapProviders.BingHybridMap;
????????????this.gMapControl1.Manager.Mode?=?AccessMode.ServerAndCache;
????????????this.gMapControl1.MinZoom?=?1;?????????????????????????????????????????????????????//最小比例
????????????this.gMapControl1.MaxZoom?=?23;????????????????????????????????????????????????????//最大比例
????????????this.gMapControl1.Zoom?=?15;???????????????????????????????????????????????????????//當(dāng)前比例
????????????this.gMapControl1.ShowCenter?=?false;??????????????????????????????????????????????//不顯示中心十字點(diǎn)
????????????this.gMapControl1.DragButton?=?System.Windows.Forms.MouseButtons.Left;?????????????//左鍵拖拽地圖
????????????this.gMapControl1.Position?=?new?PointLatLng(23113);
????????????this.gMapControl1.Overlays.Add(overlay);
????????????this.gMapControl1.MouseClick?+=?gMapControl1_MouseClick;
??????
????????}
????????List?list?=?new?List();
?????????????
????????void?gMapControl1_MouseClick(object?sender?MouseEventArgs?e)
????????{
????????????PointLatLng?p?=?this.gMapControl1.FromLocalToLatLng(e.X?e.Y);//將鼠標(biāo)點(diǎn)擊點(diǎn)坐標(biāo)轉(zhuǎn)換為經(jīng)緯度坐標(biāo)
????????????list.Add(p);
????????????#region?Marker操作
????????????//GMapMarker?marker?=?new?GMarkerGoogle(p?GMarkerGoogleType.arrow);
????????????//marker.ToolTipText?=?“點(diǎn)擊了這個(gè)點(diǎn)“;
????????????//this.overlay.Markers.Add(marker);
????????????#endregion
????????????#region?Routes操作
????????????//overlay.Routes.Clear();
????????????//GMapRoute?route=?new?GMapRoute(list?“l(fā)ine“);
????????????//route.Stroke.Color?=?Color.Red;
????????????//route.Stroke.Width?=?2;??//設(shè)置畫
????????????//overlay.Routes.Add(route);
????????????#endregion?
????????????#region?Polygons操作
????????????overlay.Polygons.Clear();
????????????GMapPolygon?polygon?=?new?GMapPolygon(list?“多邊形“);
????????????polygon.Fill?=?new?SolidBrush(Color.FromArgb(50?Color.Red));
????????????polygon.Stroke?=?new?Pen(Color.Blue2);
????????????polygon.IsHitTestVisible?=?true;
????????????overlay.Polygons.Add(polygon);
????????????#endregion
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????187??2016-08-01?11:55??GMapTest1\GMapTest1\App.config
?????文件????2462720??2016-08-01?09:32??GMapTest1\GMapTest1\bin\Debug\GMap.NET.Core.dll
?????文件?????159232??2016-08-01?09:32??GMapTest1\GMapTest1\bin\Debug\GMap.NET.WindowsForms.dll
?????文件????????187??2016-08-01?11:55??GMapTest1\GMapTest1\bin\Debug\GMapTest1.exe.config
?????文件??????24224??2016-08-01?16:22??GMapTest1\GMapTest1\bin\Debug\GMapTest1.vshost.exe
?????文件????????187??2016-08-01?11:55??GMapTest1\GMapTest1\bin\Debug\GMapTest1.vshost.exe.config
?????文件????????490??2013-03-18?17:00??GMapTest1\GMapTest1\bin\Debug\GMapTest1.vshost.exe.manifest
?????文件???????2912??2016-08-01?16:21??GMapTest1\GMapTest1\Form1.cs
?????文件???????3101??2016-08-01?15:19??GMapTest1\GMapTest1\Form1.Designer.cs
?????文件???????5817??2016-08-01?15:19??GMapTest1\GMapTest1\Form1.resx
?????文件???????4328??2016-08-01?13:32??GMapTest1\GMapTest1\GMapTest1.csproj
?????文件????????521??2016-08-01?11:55??GMapTest1\GMapTest1\Program.cs
?????文件???????1360??2016-08-01?11:55??GMapTest1\GMapTest1\Properties\AssemblyInfo.cs
?????文件???????2870??2016-08-01?11:55??GMapTest1\GMapTest1\Properties\Resources.Designer.cs
?????文件???????5612??2016-08-01?11:55??GMapTest1\GMapTest1\Properties\Resources.resx
?????文件???????1096??2016-08-01?11:55??GMapTest1\GMapTest1\Properties\Settings.Designer.cs
?????文件????????249??2016-08-01?11:55??GMapTest1\GMapTest1\Properties\Settings.settings
?????文件????????996??2016-08-01?11:55??GMapTest1\GMapTest1.sln
????..A..H.?????37888??2016-08-01?16:22??GMapTest1\GMapTest1.v12.suo
?????目錄??????????0??2016-08-01?16:22??GMapTest1\GMapTest1\bin\Debug
?????目錄??????????0??2016-08-01?11:55??GMapTest1\GMapTest1\bin
?????目錄??????????0??2016-08-01?11:55??GMapTest1\GMapTest1\Properties
?????目錄??????????0??2016-08-01?16:22??GMapTest1\GMapTest1
?????目錄??????????0??2016-08-01?11:55??GMapTest1
-----------?---------??----------?-----??----
??????????????2713977????????????????????24
- 上一篇:1433掃描大字典版
- 下一篇:Gmap鼠標(biāo)拖拽Marker
評(píng)論
共有 條評(píng)論