Silverlight学习笔记十七BingMap(二)之地图的基本控制

本篇主要介绍如何对地图的一些基本控制操作,包括地图加载模式、根据精度和纬度定位、变焦程度等。加载模式上一节已经讲过

 

 

 关于地图的定位当然是通过经度、纬度来做

    //纬度
            double latitude = 0;

            //经度
            double longitude = 0;

            double.TryParse(tbLatitude.Text, out latitude);

            double.TryParse(tbLongitude.Text, out longitude);

            //定位
            this.myMap.SetView(new Location(latitude, longitude), 5);

 通过实例化一个Location对象来实现地图的定位。其中的"5"是焦距

 

关于地图的焦距是通过ZoomLevel的值类改变

 double zoomLevel = 1d;

  •     double.TryParse(this.tbZoomLevel.Text.Trim(), out zoomLevel);
  •     this.map.ZoomLevel = zoomLevel;
  •  

    Center是地图的中心。CopyrightVisibility是地图中的Copyright的可见性

     

    源码:
    https://files.cnblogs.com/salam/SlBindMapDemo.rar

    posted @ 2010-07-28 17:04  ForrestWoo  阅读(1662)  评论(0编辑  收藏  举报