简体   繁体   English

Google Api V2的折线设置颜色选项出现错误? C#Web应用

[英]Polyline Set color option for Google Api V2 getting error ?? C# Web App

i am getting error on the line to set polyline color option my code, 我在设置代码的折线颜色选项时遇到错误,

GEvent.addListener(polyline, "click", function() {polyline.setOptions(options: { strokeColor: 'blue' })};

but if i try this, 但是如果我尝试这个

GEvent.addListener(polyline, "click", function() {alert("clicked");});

it works fine 它工作正常

How to set polyline color on click ?? 如何在单击上设置折线颜色?

i also try this, 我也尝试这个

GEvent.addListener(polyline, "click", function() {PolylineOptions({ strokeStyle: new StrokeStyle({color: 0xFF0000})}); 

it is also resulting in error HOPES for your reply... 这也会导致您的回复出现错误希望...

It looks like you're mixing up the Maps API V3 and Maps API V2 syntax. 看起来您正在混淆Maps API V3和Maps API V2语法。

  • Maps API V2 uses setStrokeStyle not setOptions to change Polyline options Maps API V2使用setStrokeStyle而非setOptions来更改折线选项
  • Maps API V2 uses hex color codes (rather than 'blue' etc) Maps API V2使用十六进制颜色代码(而不是“蓝色”等)

The following should work. 以下应该工作。

GEvent.addListener(polyline, "click", function() {
  polyline.setStrokeStyle({ color: "#FF0000" });
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM