OnPolygonClick not firing, IsHitTestVisible

Topics: Windows Forms
Feb 14, 2012 at 12:36 PM
Edited Feb 14, 2012 at 12:37 PM

Just downloaded the latest version (and tried with some of the other older versions). OnPolygonClick, OnPolygonEnter and OnPolygonLeave are not firing in the WinForms version.

On my form load event I put the following in...

            myMap.OnPolygonClick += new PolygonClick(myMap_OnPolygonClick);

            myMap.OnPolygonEnter += new PolygonEnter(myMap_OnPolygonEnter);

            myMap.OnPolygonLeave += new PolygonLeave(myMap_OnPolygonLeave);

I create a polygon with the following..

            List<PointLatLng> polygonPoints = new List<PointLatLng>();            foreach (GMapMarker m in top.Markers)            {                if (m is GMapMarker)                {                    m.Tag = polygonPoints.Count;                    polygonPoints.Add(m.Position);                }            }            GMapPolygon polygon = new GMapPolygon(polygonPoints, "polygon tester");            top.Polygons.Add(polygon);

Which draws the polygon on the map.

I create a myMap_OnPolygonClick event and put a breakpoint in but it never gets hit - same with the enter and leave events (Marker works correctly)


Have I missed something or done something wrong RadioMan?

Thanks Charlotte

Feb 14, 2012 at 1:01 PM

Figured it out - needed to add IsHitTestVisible when creating my polygons :)

Feb 14, 2012 at 1:04 PM

yes, by default polygons do not receive events

Feb 14, 2012 at 8:21 PM

Thanks for the reply radioman - GMaps project is amazing - Totally love it - many thanks for all your hard work and support.