其他分享
首页 > 其他分享> > GMap.Net 在 winform 中开发 绘制多边形和轨迹

GMap.Net 在 winform 中开发 绘制多边形和轨迹

作者:互联网

参考资料:

[GMap.Net 在 winform 中调用高德地图 ](https://www.cnblogs.com/sethnie/p/15856122.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));
            
            //绘制折线用GMapRoute 
            GMapRoute route = new GMapRoute(points, "");
            route.Stroke = new Pen(Color.Red, 1); // 折线颜色,线宽
            polyOverlay.Routes.Add(route);

            //绘制多边形用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);

  

标签:多边形,polygon,PointLatLng,GMap,Add,points,new,Net,winform
来源: https://www.cnblogs.com/sethnie/p/15856131.html