如何删除Bing Maps图例?

时间:2012-10-22 20:02:19

标签: bing-maps

如何删除Bing Maps图例?

What I don't want

1 个答案:

答案 0 :(得分:2)

如果您使用的是v7.0,则可以通过在地图的构造函数中将属性showScalebar设置为false来隐藏比例尺(在mapOption参数中),请参阅MSDN:

http://msdn.microsoft.com/en-us/library/gg427603.aspx

这是一个例子:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

      <script type="text/javascript">

         function GetMap()
         {

            // Set the map and view options, setting the map style to Road and
            //    removing the user's ability to change the map style
            var mapOptions = {credentials:"Bing Maps Key",
                              height: 400,
                              width: 400,
                              showScalebar: false};

            // Initialize the map
            var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions); 

         }

      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative;"></div>       
   </body>
</html>