2012-11-14 61 views
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] }); 

回答

0

Got it!只需要添加html内容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>' 
}; 
相关问题