是否可以使用Bing Maps API使多边形可点击? [英] Is it possible to make a Polygon clickable using the Bing Maps API?

查看:115
本文介绍了是否可以使用Bing Maps API使多边形可点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在每个Polygon的中心放置一个图钉,以实现可点击"区域,但这是我不愿意采取的额外步骤.

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.

推荐答案

是的,但是有点痛苦.这些步骤是:

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

1.)附加到VEMap中的mousclick事件 2.)确定鼠标单击是在多边形区域内还是在形状上 3.)停止向地图对象本身传播事件

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

此处的鼠标处理程序部分: http://www.codeproject.com/KB/scripting/Use_of_VEMap.aspx#heading0012 是不错的入门书,尽管如果您需要特定的代码,我也可以为您解决.

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.

请注意,您可以通过在自己的函数中返回true来停止事件的冒泡:

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

这篇关于是否可以使用Bing Maps API使多边形可点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆