Back to Devexpress

MapControl.ZoomToFitLayerItems() Method

windowsforms-devexpress-dot-xtramap-dot-mapcontrol-b7352f63.md

latest4.8 KB
Original Source

MapControl.ZoomToFitLayerItems() Method

Zooms the map to fit items contained by the MapControl.Layers property.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public void ZoomToFitLayerItems()
vb
Public Sub ZoomToFitLayerItems

Remarks

When vector items loading in a runtime this method should be called from LayerBase.DataLoaded event handler.

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

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.

winforms-map-convert-a-cartesian-data-shapefile-to-geo-coordinates/CS/MapSample/Form1.cs#L70

csharp
{
        mapControl1.ZoomToFitLayerItems();
}

winforms-map-execute-the-search-operation-for-multiple-locations/CS/GetSearchLocationAdditionalInfo/Form1.cs#L52

csharp
if (idx == addresses.Count)
        map.ZoomToFitLayerItems();
}

winforms-map-load-data-from-a-sql-geometry-data-source/CS/SqlGeometry/Form1.cs#L33

csharp
void layer_DataLoaded(object sender, DataLoadedEventArgs e) {
    mapControl1.ZoomToFitLayerItems();
}

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/WaypointMap/WaypointMapItemControlProvider.cs#L56

csharp
mapItemStorage.Items.EndUpdate();
map.ZoomToFitLayerItems();
SetSelectionMode();

winforms-map-convert-a-cartesian-data-shapefile-to-geo-coordinates/VB/MapSample/Form1.vb#L60

vb
Private Sub vectorItemsLayer1_DataLoaded(ByVal sender As Object, ByVal e As DataLoadedEventArgs) Handles vectorItemsLayer1.DataLoaded
        mapControl1.ZoomToFitLayerItems()
End Sub

winforms-map-execute-the-search-operation-for-multiple-locations/VB/GetSearchLocationAdditionalInfo/Form1.vb#L51

vb
AddPushpin(region.Location)
    If idx = addresses.Count Then map.ZoomToFitLayerItems()
Next

winforms-map-load-data-from-a-sql-geometry-data-source/VB/SqlGeometry/Form1.vb#L32

vb
Private Sub layer_DataLoaded(ByVal sender As Object, ByVal e As DevExpress.XtraMap.DataLoadedEventArgs)
    Me.mapControl1.ZoomToFitLayerItems()
End Sub

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/WaypointMap/WaypointMapItemControlProvider.vb#L70

vb
mapItemStorage.Items.EndUpdate()
map.ZoomToFitLayerItems()
SetSelectionMode()

See Also

MapControl Class

MapControl Members

DevExpress.XtraMap Namespace