Route Stroke Issue GMAP 路径样式问题

I was trying to figure out why when I changed the color of one of my routes (using route.Stroke.Color = something) all of my routes would change color. When I dug into your code a bit I figured out what’s going on.

On line 188 of GMapRoute.cs you have

public Pen Stroke = DefaultStroke

The problem is even though DefaultStroke is readonly if I change any of the properties associated with the stroke of one route it will change the properties of DefaultStroke which will then affect all routes that are using the default.

Changing line 188 to the following prevents the issue:

public Pen Stroke = DefaultStroke.Clone() as Pen;

在引用GMAP源代码后出现了路径样式问题:
改变某个路径样式,所有路径的样式均会改变。参考以上方法可以解决。

猜你喜欢

转载自blog.csdn.net/Csq_123456/article/details/86536799