windowsforms-devexpress-dot-xtramap-dot-mapcontrol-ef0306c4.md
Gets or sets the current zoom level of a Map Control.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
[DefaultValue(1)]
public double ZoomLevel { get; set; }
<DefaultValue(1)>
Public Property ZoomLevel As Double
| Type | Default | Description |
|---|---|---|
| Double | 1 |
A double value specifying the current zoom level.
|
using DevExpress.XtraMap;
// ...
const string azureKey = "your key";
// ...
private void Form1_Load(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 layer1 = new ImageLayer();
layer1.DataProvider = new AzureMapDataProvider() {
AzureKey = azureKey,
// Set Imagery tileset to display a satellite or aerial imagery on a layer.
Tileset = AzureTileset.Imagery,
};
// Create a layer.
ImageLayer layer2 = new ImageLayer();
layer2.DataProvider = new AzureMapDataProvider(){
AzureKey = azureKey,
// Set BaseLabelsRoad tileset to display boundaries and label data in the Azure Map style on a layer.
Tileset = AzureTileset.BaseLabelsRoad,
};
// Specify the map zoom level and center point.
map.ZoomLevel = 3;
map.CenterPoint = new GeoPoint(40, -100);
// Add the created layers to the collection.
map.Layers.AddRange(new LayerBase[] {
layer1, layer2});
// Add the map control to the window.
this.Controls.Add(map);
}
Imports DevExpress.XtraMap
'...
Private Const azureKey As String = "your key"
' ...
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a map control.
Dim map As New MapControl()
' Specify the map position on the form.
map.Dock = DockStyle.Fill
' Create a layer.
Dim layer1 As New ImageLayer()
layer1.DataProvider = New AzureMapDataProvider() With {
.AzureKey = azureKey,
.Tileset = AzureTileset.Imagery
}
' Create a layer.
Dim layer2 As New ImageLayer()
layer2.DataProvider = New AzureMapDataProvider() With {
.AzureKey = azureKey,
.Tileset = AzureTileset.BaseLabelsRoad
}
' Specify the map zoom level and center point.
map.ZoomLevel = 3
map.CenterPoint = New GeoPoint(40, -100)
' Add the created layers to the collection.
map.Layers.AddRange(New LayerBase() { layer1, layer2})
' Add the map control to the window.
Me.Controls.Add(map)
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.
map.CenterPoint = geoPoint;
map.ZoomLevel = 15;
}
map.CenterPoint = geoPoint
map.ZoomLevel = 15
End Sub
See Also