window phone开发之 Map控件
webphp
13年前
<div id="article_content" class="article_content"> <p>1. 加一个标记:</p> <p>加标记,是地图中最常用的方法。它和bing map又有所不同,首先所在的命名空间不同;其次显示方式不同;但总之都是可以在模拟上运行的。</p> <p align="left">Pushpin pin = new Pushpin();</p> <p align="left">pin.Location = new GeoCoordinate(30.259497, 120.129798);</p> <p align="left">pin.Width = 200;</p> <p align="left">pin.Height = 200;</p> <p align="left">pin.Content = "test";</p> <p align="left">pin.Background = new SolidColorBrush(Colors.Red);</p> <p>Map控件显示的标记</p> <p>bing map控件显示的标记</p> <p> </p> <p>2. 绘制多边型区域:</p> <p align="left">MapPolygon polygon = new MapPolygon();</p> <p align="left">polygon.Locations = new LocationCollection() { new GeoCoordinate(30.259497, 120.129798),</p> <p align="left"> new GeoCoordinate(30.359497, 120.329998),</p> <p align="left"> new GeoCoordinate(30.379497, 120.529798),</p> <p align="left"> new GeoCoordinate(30.389497, 120.729798) };</p> <p> </p> <p>3. 绘制多边线:</p> <p align="left">MapPolyline polyline = new MapPolyline();</p> <p align="left">polyline.Stroke = new SolidColorBrush(Colors.Red);</p> <p align="left">polyline.Locations = new LocationCollection() {</p> <p align="left"> new GeoCoordinate(30.259497, 120.129798),</p> <p align="left"> new GeoCoordinate(30.289497, 120.120998) </p> <p align="left"> };</p> <p><span style="font-family:Calibri;">4.</span>在地图上增加图片<span style="font-family:Calibri;">:</span></p> <p align="left">MapLayer imagelayer = new MapLayer();</p> <p align="left">imagelayer.AddChild(image, new GeoCoordinate(30.259497, 120.129798), PositionOrigin.BottomLeft);</p> </div>