Craig,
The following code works properly on my side, please get it and follow the steps below,
Public Class DisplayShapeMap
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
Private Sub DisplayMap_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
winformsMap1.MapUnit = GeographyUnit.DecimalDegree
winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
Dim shapefileLayer As New ShapeFileFeatureLayer("../../sampledata/data/countries02.shp")
shapefileLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1
shapefileLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim overlay As New LayerOverlay
overlay.Layers.Add(shapefileLayer)
winformsMap1.Overlays.Add(overlay)
winformsMap1.CurrentExtent = New RectangleShape(-139.2, 92.4, 120.9, -93.2)
'comment this line when load the program for the second time
winformsMap1.Refresh()
End Sub
Private Sub save_Click(sender As System.Object, e As System.EventArgs) Handles save.Click
Dim centerX = winformsMap1.CurrentExtent.GetCenterPoint().X
Dim centerY = winformsMap1.CurrentExtent.GetCenterPoint().Y
Dim scale = winformsMap1.CurrentScale
File.WriteAllText("a.txt", centerX.ToString + "," + centerY.ToString + "," + scale.ToString)
End Sub
Private Sub load_Click(sender As System.Object, e As System.EventArgs) Handles load.Click
Dim result = File.ReadAllText("a.txt")
Dim results = result.Split(",")
winformsMap1.CenterAt(New PointShape(Convert.ToDouble(results(0)), Convert.ToDouble(results(1))))
winformsMap1.ZoomToScale(Convert.ToDouble(results(2)))
winformsMap1.Refresh()
End Sub
End Class
1. Load the program, click save button and exit.
2. Comment the line: winformMap1.Refresh() and rerun it.
3. Click the load button, the map shows up.
Hope it helps,
Edgar