private void Copyandoverwritemap ()
{
Get Iobjectcopy Interface
Iobjectcopy objectcopy = new Objectcopyclass ();
Get IUnknown Interface (map to copy)
Object tocopymap = AxPageLayoutControl1.ActiveView.FocusMap;
Each Map contained within the pagelayout encapsulated by the
Pagelayoutcontrol, resides within a separate mapframe, and therefore
The their Imap::isframed property is set to True. A Map contained within the
Mapcontrol does not reside within a mapframe. As such before
Overwriting the Mapcontrol ' s map, the Imap::isframed property must is set
To False. Failure to does this would lead to corrupted map documents saved
containing the contents of the Mapcontrol.
IMAP map = TOCOPYMAP as IMAP;
Map. Isframed = false;
Get IUnknown Interface (copied map)
Object copiedmap = Objectcopy.copy (Tocopymap);
Get IUnknown Interface (map to overwrite)
Object tooverwritemap = Axmapcontrol1.map;
Overwrite the Mapcontrol ' s map
Objectcopy.overwrite (Copiedmap, ref tooverwritemap);
Setmapextent ();
}
Copy Map Copyandoverwritemap ()