A newer version of this page is available. Switch to the current version.

MapControl Class

Displays raster and vector maps. Supports both popular map services (Bing Maps and OpenStreetMap) and custom map data servers inside your corporate network. See Map Control.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.1.dll

Declaration

[ComVisible(true)]
[ToolboxBitmap(typeof(MapControl), "Bitmaps256.MapControl.bmp")]
[Docking(DockingBehavior.Ask)]
public class MapControl :
    Control,
    IMapControl,
    ISupportChildsControl,
    ISupportLookAndFeel,
    ISupportInitialize,
    IToolTipControlClient,
    IGestureClient,
    IMouseWheelSupport,
    IMouseWheelScrollClient,
    IPrintable,
    IBasePrintable,
    IServiceContainer,
    IServiceProvider,
    IMapControlEventsListener,
    IComponentChangeServiceProvider,
    IDesignTimeInteractionProvider,
    IDrawEventsProvider
<ComVisible(True)>
<ToolboxBitmap(GetType(MapControl), "Bitmaps256.MapControl.bmp")>
<Docking(DockingBehavior.Ask)>
Public Class MapControl
    Inherits Control
    Implements IMapControl,
               ISupportChildsControl,
               ISupportLookAndFeel,
               ISupportInitialize,
               IToolTipControlClient,
               IGestureClient,
               IMouseWheelSupport,
               IMouseWheelScrollClient,
               IPrintable,
               IBasePrintable,
               IServiceContainer,
               IServiceProvider,
               IMapControlEventsListener,
               IComponentChangeServiceProvider,
               IDesignTimeInteractionProvider,
               IDrawEventsProvider

Related API Members

The following members accept/return MapControl objects:

Remarks

The DevExpress Map control provides all the functionality required to embed popular map services into your WinForms applications. You are free to choose from any existing map data resource (like Bing Maps or OpenStreetMap) or establish your own map data server inside your corporate network.

In addition to using raster map images, you can also utilize vector elements of any shape, stored either in Shapefiles or other formats. The control has built-in navigation elements, supports animated zooming, element highlighting and so much more.

The following image demonstrates a MapControl.

BingMap

To get acquainted with using the MapControl, please refer to the Getting Started section.

Examples

This example describes how to add a MapControl to a Windows Forms application and connect the control to the BingMapDataProvider data provider at runtime.

  1. Run MS Visual Studio.
  2. Create a new Windows Forms Application project or open an existing one.
  3. Open the Solution Explorer, right-click References and choose Add Reference... to add the Map Control Library.

    Add Reference

  4. Select the following assemblies in the Extensions tab:

    • DevExpress.XtraMap
    • DevExpress.Map.Core
    • DevExpress.Data
    • DevExpress.Utils

    Add Assemblies

    Click OK.

  5. Handle the Form.Load event as follows:

    using System;
    using System.Windows.Forms;
    using DevExpress.XtraMap;
    
    namespace MapControlRuntimeSample {
        public partial class Form1 : Form {
            public Form1() {
                InitializeComponent();
            }
            private void OnFormLoad(object sender, EventArgs e) {
                // Create a map control.
                MapControl map = new MapControl();
    
                // Specify the map position on the form.           
                map.Dock = DockStyle.Fill;
    
                // Create a layer.
                ImageLayer layer = new ImageLayer();
                map.Layers.Add(layer);
    
                // Create a data provider.
                BingMapDataProvider provider = new BingMapDataProvider();
                provider.BingKey = "Your Bing Maps key";
                layer.DataProvider = provider;
    
                // Specify the map zoom level and center point. 
                map.ZoomLevel = 3;
                map.CenterPoint = new GeoPoint(40, -100);
    
                // Add the map control to the window.
                this.Controls.Add(map);
            }
        }
    }
    

    The example above uses the following entities:

    Class Description
    MapControl Displays raster and vector maps. Supports both popular map services (Bing Maps and OpenStreetMap) and custom map data servers inside your corporate network. See Map Control.
    ImageLayer Displays map images obtained from map image data providers.
    BingMapDataProvider The class that loads map images from the Bing Maps data provider.
See Also