Is it possible to make a Polygon clickable using t

2019-08-03 00:21发布

问题:

I can put a pushpin in the center of each Polygon to achieve a "clickable" region but that is an extra step I'd rather not take.

回答1:

Yes, but it's kind of a pain. The steps are:

1.) attach to the mousclick event within VEMap 2.) determine if the mouseclick was within the area of your polygon or on a shape 3.) stop event propogation to the map object itself

The mousehandler portion here: http://www.codeproject.com/KB/scripting/Use_of_VEMap.aspx#heading0012 is a decent primer, though if you need specific code I can work that up for you as well.

As a note, you stop the bubbling of the event by returning true within your own funciton: http://msdn.microsoft.com/en-us/library/bb412543.aspx