The problem came up because I was adding the overlay over and over again....
Thanks for the hint radioman
Heres the code:
Thanks for the hint radioman
Heres the code:
if (e.Button == MouseButtons.Left && Global.isDrawingPolygon)
{
polyOverlay.Polygons.Clear();
double lat = gmap.FromLocalToLatLng(e.X, e.Y).Lat;
double lng = gmap.FromLocalToLatLng(e.X, e.Y).Lng;
if (Global.tmpPolygonList.Count == 0)
{
Global.tmpPolygonList.Add(new PointLatLng(lat,lng));
polygon = new GMapPolygon(Global.tmpPolygonList, "myFirstpolygon");
polygon.Fill = new SolidBrush(Color.FromArgb(20, Color.White));
polygon.Stroke = new Pen(Color.Blue, 5);
gmap.Overlays.Add(polyOverlay);
}
else
{
polygon.Points.Add(new PointLatLng(lat, lng));
}
polyOverlay.Polygons.Add(polygon);
gmap.UpdatePolygonLocalPosition(polygon);
}
}