Back to Devexpress

MapControl.ScrollArea Property

windowsforms-devexpress-dot-xtramap-dot-mapcontrol-18478bc5.md

latest2.6 KB
Original Source

MapControl.ScrollArea Property

Gets or sets a rectangular area (also called scroll area) that confines the map center point.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public MapBounds ScrollArea { get; set; }
vb
Public Property ScrollArea As MapBounds

Property Value

TypeDescription
MapBounds

The boundaries that specify the area in which the map center point can be moved around.

|

Remarks

Use this property to limit scroll operations so that the map center point remains within the boundaries. To define these boundaries, specify the coordinates of the area’s top-left and bottom-right corners.

In the following animation, a rectangle depicts the scroll area boundaries and a dot indicates the map center position:

Example

This example specifies a rectangular area that confines the map center point:

csharp
using DevExpress.XtraMap;
using System;
using System.Drawing;
using System.Windows.Forms;
//...
    private void Form1_Load(object sender, EventArgs e) {
        mapControl1.ScrollArea = new DevExpress.Map.MapBounds(
            new GeoPoint(44.568441, -11.877712), 
            new GeoPoint(36.219329, 4.030490));
        mapControl1.CenterPoint = new GeoPoint(40.155242, -2.912869);
        mapControl1.ZoomLevel = 4.5;
    }
//...
vb
Imports DevExpress.XtraMap
Imports System.Windows.Forms
'...
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        mapControl1.ScrollArea = New DevExpress.Map.MapBounds(New GeoPoint(44.568441, -11.877712), New GeoPoint(36.219329, 4.030490))
        mapControl1.CenterPoint = New GeoPoint(40.155242, -2.912869)
        mapControl1.ZoomLevel = 4.5
    End Sub
'...

See Also

Scroll the Map

MapControl Class

MapControl Members

DevExpress.XtraMap Namespace