在Silverlight 2應用程序中集成Virtual Earth
[1] 在Silverlight 2應用程序中集成Virtual Earth
[2] 在Silverlight 2應用程序中集成Virtual Earth
[3] 在Silverlight 2應用程序中集成Virtual Earth
[4] 在Silverlight 2應用程序中集成Virtual Earth
[2] 在Silverlight 2應用程序中集成Virtual Earth
[3] 在Silverlight 2應用程序中集成Virtual Earth
[4] 在Silverlight 2應用程序中集成Virtual Earth
概述
Virtual Earth是什么,我想不用多做解釋了。微軟在推出自己的Virtual Earth之后,開放了大量的APIs,使得我們可以方便集成到自己的應用程序中。
本文將介紹如何在自己的Silverlight 2應用程序中集成Virtual Earth。
在HTML中集成
在開始之前,我們先來簡單看一下如何在HTML中集成Virtual Earth,大家可以去這里查詢相關APIs,我們來看看如何加載默認地圖,如下代碼所示:
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></script> <script type="text/javascript"> var map = null; function GetMap() { map = new VEMap('myMap'); map.LoadMap(); } </script> </head> <body onload="GetMap();"> <div id='myMap' style="position:relative; width:480px; height:320px;"></div> </body> </html>
其實這段代碼非常簡單的簡單,首先引入Virtual Earth Map控件,并且使用JavaScript來加載地圖。
全站熱搜