0

这是我用来在 Bing 地图上绘制自定义图钉的代码。我无法在图钉图标上打印文本,该图钉图标只是默认图钉,但颜色不同。

甚至有可能这样吗?还有其他方法吗?好像没找到,求救!

var pushpinOptions = {icon: '/assets/greenpin.png', visible: true};
var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(lat, lng), pushpinOptions, {text: alphas[i] });
4

1 回答 1

0

知道了!只需将 htmlContent 添加到 pushpinOptions

var pushpinOptions = {icon: '/assets/greenpin.png', 
    visible: true, 
    htmlContent: '<div style="position: absolute; text-align: center; width: 100%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: bold; line-height: normal; color: rgb(255, 255, 255); left: 0px; top: 5px; ">'+alphas[i]+'</div>'
};
于 2012-11-19T01:17:02.247 回答