码迷,mamicode.com
首页 > 其他好文 > 详细

拷贝地图 CopyAndOverwriteMap()

时间:2015-09-22 08:51:58      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

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
//have their IMap::IsFramed property 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 be set
//to False. Failure to do this will 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();
}

拷贝地图 CopyAndOverwriteMap()

标签:

原文地址:http://www.cnblogs.com/gisoracle/p/4827871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!