这是我用来在Bing Maps上绘制自定义图钉的代码。我无法在图钉图标上打印文本,图标只是默认的图钉,但颜色不同。
甚至可能这样吗?还有另外一种方法吗?我似乎无法找到任何帮助!
var pushpinOptions = {icon: '/assets/greenpin.png', visible: true};
var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(lat, lng), pushpinOptions, {text: alphas[i] });
答案 0 :(得分: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>'
};