在Silverlight 2應用程序中集成Virtual Earth

作者: TerryLee  來源: 博客園  發布時間: 2008-10-10 10:51  閱讀: 3529 次  推薦: 0   原文鏈接   [收藏]  
 

概述

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來加載地圖。

TerryLee_0094

 

0
0
 
 
 

文章列表

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()