I'm working with a MapBox object from SharpMap in a Windows Forms C# app and I can't seem to find how to make the zoom level work. The MapBox object is in a TabControl object.
This class is called after the main InitializeComponent() call in my app.
public void InitializeMap(SharpMap.Forms.MapBox mapBox)
{
mapBox.Map.BackgroundLayer.Add(new SharpMap.Layers.TileAsyncLayer(
new BruTile.Web.OsmTileSource(), "OSM"));
mapBox.Map.Zoom = 10; //
mapBox.Refresh();
}
Whatever value written for the mapBox.Map.Zoom attribute, it's always the same high zoom level.
On the other hand, if I use mapBox.Map.ZoomToExtents()
call, it zooms to the extents of the OSM layer correctly.
I suppose I'm doing wrong a simple thing, but I can't seem to find what is the problem.