Skip to main content

MapControl.ZoomLevel Property

Gets or sets the current zoom level of a Map Control.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.1.dll

NuGet Package: DevExpress.Win.Map

Declaration

[DefaultValue(1)]
public double ZoomLevel { get; set; }

Property Value

Type Default Description
Double 1

A double value specifying the current zoom level.

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.

image

  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.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ZoomLevel property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also