参考资料
[GMap.Net 在 winform 中调用高德地图 ](https://www.cnblogs.com/sethnie/p/15856122.html)
[GMap.Net 在 winform 中开发 绘制多边形和轨迹](https://www.cnblogs.com/sethnie/p/15856131.html)
绘制多边形并着色
// 添加多边形节点 List<PointLatLng> points = new List<PointLatLng>(); points.Add(new PointLatLng(37.1412768409666, 79.6562057733536)); points.Add(new PointLatLng(37.1403574434934, 79.6564793586731)); points.Add(new PointLatLng(37.1405669815751, 79.6581155061722)); points.Add(new PointLatLng(37.1416146632773, 79.6577936410904)); points.Add(new PointLatLng(37.1412768409666, 79.6562057733536)); //绘制多边形用GMapPolygon GMapPolygon polygon = new GMapPolygon(points, "polygons"); polygon.Fill = new SolidBrush(Color.FromArgb(50, Color.Green));// 配置多边形填充颜色 polygon.Stroke = new Pen(Color.Red, 1); polyOverlay.Polygons.Add(polygon); gMapControl.Overlays.Add(polyOverlay);
改变着色
/// <summary> /// 改变 Polygons 填充颜色 /// </summary> /// <param name="name">Polygons 名称</param> /// <param name="color">Polygons 填充颜色</param> void changePolygonsColor(String name,Color color) { for (int i = 0; i < gMapControl.Overlays.Count; i++) { for (int j = 0; j < gMapControl.Overlays[i].Polygons.Count; j++) { if (gMapControl.Overlays[i].Polygons[j].Name == name) { gMapControl.Overlays[i].Polygons[j].Fill = new SolidBrush(Color.FromArgb(50, color)); } } } }