Back to Devexpress

MapControl.ZoomToFitLayerItems(Double) Method

windowsforms-devexpress-dot-xtramap-dot-mapcontrol-dot-zoomtofitlayeritems-x28-system-dot-double-x29.md

latest3.7 KB
Original Source

MapControl.ZoomToFitLayerItems(Double) 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(
    double paddingFactor
)
vb
Public Sub ZoomToFitLayerItems(
    paddingFactor As Double
)

Parameters

NameTypeDescription
paddingFactorDouble

A Double object, which tunes the border size around visible map items.

|

Remarks

  • When vector items loading in a runtime this method should be called from LayerBase.DataLoaded event handler.
  • This method works as follows.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ZoomToFitLayerItems(Double) 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-customize-coordinate-systems-of-a-map/CS/CoordinateSystems/Form1.cs#L61

csharp
void DataLayer_DataLoaded(object sender, DataLoadedEventArgs e) {
    mapControl.ZoomToFitLayerItems(0.4);
}

winforms-map-load-cartesian-data-to-a-map-control-with-a-coordinate-converter/CS/BuildInCoordinateConverters/Form1.cs#L85

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

winforms-map-customize-coordinate-systems-of-a-map/VB/CoordinateSystems/Form1.vb#L61

vb
Private Sub DataLayer_DataLoaded(ByVal sender As Object, ByVal e As DataLoadedEventArgs)
    mapControl.ZoomToFitLayerItems(0.4)
End Sub

winforms-map-load-cartesian-data-to-a-map-control-with-a-coordinate-converter/VB/BuildInCoordinateConverters/Form1.vb#L39

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

See Also

MapControl Class

MapControl Members

DevExpress.XtraMap Namespace