首页 > 其他 > 详细

拷贝地图 CopyAndOverwriteMap()

时间:2015-09-22 08:49:27      阅读:272      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!