Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Collapse]Map Control
   [Collapse]Getting Started
     Lesson 1 - Connect to the Images Provider
     Lesson 2 - Load a Vector Cartesian Map
     Lesson 3 - Add Analytical Data to a Geographical Map
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 1 - Connect to the Images Provider

This is the first tutorial in the Getting Started series for the WinForms Map control and guides you through the process of creating a simple map application that displays the map.

This tutorial consists of the following steps:

Expanded Step 1. Add a Map Control

In this step, you are performing the common actions required to add a Map control to your application.

  • Run MS Visual Studio 2010, 2012, 2013, 2015 or 2017.

  • Create a new Windows Forms Application project by selecting File | New | Project... in the main menu of Visual Studio, and in the invoked New Project menu, select Windows Forms Application.
  • Add the MapControl component to your project.

    To do this, locate the MapControl item in the Toolbox in the DX.17.1: Data & Analytics tab and drop it onto the form.

  • Click the Map control's smart tag to invoke its actions list. In the Actions list, clicking the Dock in Parent Container link allows the Map control to occupy all of the available space on the form.

  • After docking the Map control, it appears as follows:

  • Sometimes, you may need to show a specific area on a map. To do this, set the required value to the MapControl.CenterPoint property.

    For example, set the MapControl.CenterPoint property value to 45,18. When an image layer is added to a MapControl, Europe is in the center of the map.

  • To specify the current zoom level for all map layers, use the MapControl.ZoomLevel property (set its value to 4).

You have now added a Map control to your application. In the next section, it describes how to connect this control to an image tiles data provider.

Expanded Step 2. Connect to an Images Provider

The Map control can display multiple layers to draw images or vector elements. To load images from a certain image provider, use the ImageLayer object. It is necessary to draw the map.

In this lesson, the Bing Maps image tiles provider is used.

Note

It is possible to use the OpenStreetMap image tiles provider, the WMS provider, or to load image tiles from the local directory. Refer to the following topics for more information:

The Map control provides two ways of connecting to the Bing Maps provider: manual and automatic. Here they are in greater detail:

Manually Connect to the Bing Maps Provider

You can add an image layer and bind it to the Bing Maps service by performing the following steps:

  • Select the Click here to add layer link on the MapControl surface.

  • Locate the Image Layer item in the invoked list.

  • Select the Connect to Bing Maps item to obtain map images from the Bing Maps service for the layer.

Automatically Connect to the Bing Maps Provider

  • Connect to the Bing Maps data provider using the Connect to Bing Maps link in the map's smart tag tasks, as shown below. This allows you to connect to the map control automatically.

Note

Refer to How to: Get a Bing Maps Key if you run the application and see a window with the following error message: "The specified Bing Maps key is invalid. To create a developer account, refer to http://www.microsoft.com/maps/developers".

Expanded Step 3. Customize an Images Provider

The BingMapDataProvider object should be configured before use by doing the following:

Expanded Step 4. Adding a Mini Map

Sometimes, you may need to show a mini map. For this, do the following:

Map control customization is complete.

Expanded Result

Run the application to see the result.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5069.

Expanded See Also

How would you rate this topic?​​​​​​​