MapControl.ZoomToRegion(CoordPoint, CoordPoint, Double, Boolean) Method
Zooms the map to the specified region. Allows you to set whether the map should use a non-negative integer zoom level.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v24.2.dll
NuGet Package: DevExpress.Win.Map
#Declaration
public void ZoomToRegion(
CoordPoint topLeft,
CoordPoint bottomRight,
double paddingFactor,
bool roundZoomLevel
)
#Parameters
Name | Type | Description |
---|---|---|
top |
Coord |
The top-left coordinate of the region. |
bottom |
Coord |
The bottom-right coordinate of the region. |
padding |
Double | Specifies the percentage size of the border around displayed map items . |
round |
Boolean | Specifies whether to round the zoom level value. |
#Remarks
The padding factor is applied to the larger dimension of a region.
The following image shows an instance of a horizontal dimension that is larger than the vertical (“PF” means “Padding Factor” on an image).
Note that the padding factor is divided by two for each side of the region.
#Example
The following code zooms a map into a region. The paddingFactor
parameter is set to 0.3
so that zoom region is 70% of a map surface.
using DevExpress.XtraMap;
private void OnVectorLayerDataLoaded(object sender, DataLoadedEventArgs e) {
mapControl1.ZoomToRegion(
topLeft: new GeoPoint(61.6, 1.9),
bottomRight: new GeoPoint(48.1, 32.1),
paddingFactor: 0.3,
roundZoomLevel: true);
}