Skip to main content
All docs
V24.2

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

Declaration

public void ZoomToRegion(
    CoordPoint topLeft,
    CoordPoint bottomRight,
    double paddingFactor,
    bool roundZoomLevel
)

Parameters

Name Type Description
topLeft CoordPoint

The top-left coordinate of the region.

bottomRight CoordPoint

The bottom-right coordinate of the region.

paddingFactor Double

Specifies the size of the border around displayed map items.

roundZoomLevel 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).

ZoomToRegion_HorizontalPadding

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:

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);
}
See Also