I recently switched from the WPF map control to the winforms. I noticed that I am not able to zoom in all the way in the winforms version, even though the code is exactly the same.
Below is the main function:
private void UserControl1_Load(object sender, System.EventArgs e)
{
string mainShapeFilePath = @"../../AppData/Merge_Countries.shp";
winformsMap1.MapUnit = GeographyUnit.Meter;
ShapeFileFeatureLayer.BuildIndexFile(mainShapeFilePath, BuildIndexMode.DoNotRebuild);
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(mainShapeFilePath);
AreaStyle areaStyle = new AreaStyle();
areaStyle.FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));
areaStyle.OutlinePen = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
worldLayer.Name = "World Layer";
worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));
worldOverlay.Layers.Add("World Layer", worldLayer);
winformsMap1.Overlays.Add("World Overlay", worldOverlay);
winformsMap1.Refresh();
}
Attached is the shapefile I’m using:
testShapefile.zip (2.5 MB)
Please change the first line in the function to whatever filepath you extract the shapefile to.
Not sure what’s different between the wpf and winform versions that could cause this.
Here’s a pic of how far I’m able to zoom in. On the WPF version using the same shapefile, I can zoom in 17 more times.