Dashed Polylines in Virtual Earth

Virtual Earth has a lot of options for for working with shapes, unfortunately there are so many additional options that are not document (thus unsupported) that are available. However, just because it’s not documented doesn’t mean it can’t be used, it just means that it may break at any time and if it does then it’s no ones fault but your own. Now that the fair warning is out of the way here is how to draw dashed polylines.

Before adding a polyline to the map set the VEShapeStyle.prototype.stroke_dashstyle  property to one of the following:

  • Solid
  • DashDot
  • ShortDash
  • ShortDot
  • ShortDashDot
  • ShortDashDotDot
  • Dot
  • Dash
  • LongDash
  • LongDashDot
  • LongDashDotDot

For an added effect, resize the width of the polyline based on the zoom level.

I’ve put together a nice little sample of how to do this which can be downloaded here:

http://cid-e7dba9a4bfd458c5.skydrive.live.com/self.aspx/VE%20Sample%20code/dashedLines.zip

Here is a screen shot of what the sample program looks like:

image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s