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.v24.2.dll
NuGet Package: DevExpress.Win.Map
#Declaration
[ComVisible(true)]
public class MapControl :
Control,
IMapControl,
ISupportChildsControl,
ISupportLookAndFeel,
ISupportInitialize,
IToolTipControlClient,
IGestureClient,
IMouseWheelSupport,
IMouseWheelScrollClient,
IPrintable,
IBasePrintable,
IServiceContainer,
IServiceProvider,
IMapControlEventsListener,
ILegendItemCreatingListener,
IComponentChangeServiceProvider,
IDesignTimeInteractionProvider,
IDrawEventsProvider,
IDpiProvider,
IDirectXProviderOwner,
IDirectXClientProvider
#Related API Members
The following members 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.
To get acquainted with using the MapControl, please refer to the Getting Started section.
#Example
This example describes how to add a MapControl
to a Windows Forms application and connect the control to the BingMapDataProvider data provider at runtime.
- Run MS Visual Studio.
- Create a new Windows Forms Application project or open an existing one.
Open the Solution Explorer, right-click References and choose Add Reference… to add the Map Control Library.
Select the following assemblies in the Extensions tab:
- DevExpress.XtraMap
- DevExpress.Map.Core
- DevExpress.Data
- DevExpress.Utils
Click OK.
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 Map
Control Displays raster and vector maps. Supports both popular map services (Bing Maps and Open Street Map Control.Map) and custom map data servers inside your corporate network. See Image Layer Displays map images obtained from map image data providers. Bing Map Data Provider The class that loads map images from the Bing Maps data provider.