Esempio n. 1
0
        private void PrepareMap()
        {
            // Create a map control.
            map = new MapControl();

            // Specify the map position on the form.
            map.Dock = DockStyle.Fill;

            // Add the map control to the window.
            this.Controls.Add(map);

            // Bring the map to the front.
            map.BringToFront();

            // Create an image tiles layer and add it to the map.
            ImageLayer tilesLayer = new ImageLayer();

            map.Layers.Add(tilesLayer);

            // Create an information layer and add it to the map.
            InformationLayer infoLayer = new InformationLayer();

            map.Layers.Add(infoLayer);

            VectorItemsLayer items = new VectorItemsLayer();

            items.Data = new MapItemStorage();
            map.Layers.Add(items);

            // Create a Bing data provider and specify the Bing key.
            BingMapDataProvider bingProvider = new BingMapDataProvider();

            tilesLayer.DataProvider = bingProvider;
            bingProvider.BingKey    = yourBingKey;

            // Create a Bing search data provider and specify the Bing key.
            searchProvider                    = new BingSearchDataProvider();
            infoLayer.DataProvider            = searchProvider;
            searchProvider.GenerateLayerItems = false;
            searchProvider.BingKey            = yourBingKey;
            map.ShowSearchPanel               = false;
        }