windowsforms-devexpress-dot-xtramap-dot-mapcontrol-b7352f63.md
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
public void ZoomToFitLayerItems()
Public Sub ZoomToFitLayerItems
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
{
mapControl1.ZoomToFitLayerItems();
}
if (idx == addresses.Count)
map.ZoomToFitLayerItems();
}
winforms-map-load-data-from-a-sql-geometry-data-source/CS/SqlGeometry/Form1.cs#L33
void layer_DataLoaded(object sender, DataLoadedEventArgs e) {
mapControl1.ZoomToFitLayerItems();
}
mapItemStorage.Items.EndUpdate();
map.ZoomToFitLayerItems();
SetSelectionMode();
winforms-map-convert-a-cartesian-data-shapefile-to-geo-coordinates/VB/MapSample/Form1.vb#L60
Private Sub vectorItemsLayer1_DataLoaded(ByVal sender As Object, ByVal e As DataLoadedEventArgs) Handles vectorItemsLayer1.DataLoaded
mapControl1.ZoomToFitLayerItems()
End Sub
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
Private Sub layer_DataLoaded(ByVal sender As Object, ByVal e As DevExpress.XtraMap.DataLoadedEventArgs)
Me.mapControl1.ZoomToFitLayerItems()
End Sub
mapItemStorage.Items.EndUpdate()
map.ZoomToFitLayerItems()
SetSelectionMode()
See Also