I have a stand-alone application written in C#. I want to be able to save and restore the current map view (extent) that the user sees. I assumed that it would be as simple as saving the active view's extent and then later resetting it, but that doesn't seem to work.
Here is some code:
_myModel.Envelope = _axMapControl.ActiveView.Extent; // save it
...
_axMapControl.Extent = _myModel.Envelope; // doesn't work
_axMapControl.ActiveView.Extent = _myModel.Envelope; // also doesn't work
_axMapControl.Refresh(); // doesn't do anything
_axMapControl.ActiveView.Refresh(); // doesn't do anything
_axMapControl.ActiveView.ContentsChanged(); // doesn't do anything
Note that after the assignments, both _axMapControl.Extent and _axMapControl.ActiveView.Extent values are unchanged.