private void changLayoutTemp2(IActiveView activeView, IPageLayout pageLayout, IPageLayout pTempPageLayout)
{
IPage pTempPage = pTempPageLayout.Page; //set page size and units
IPage pCurPage = pageLayout.Page;
pCurPage.Units = pTempPage.Units;
pCurPage.Orientation = pTempPage.Orientation; double dWidth, dHeight;
pTempPage.QuerySize(out dWidth, out dHeight);
pCurPage.PutCustomSize(dWidth, dHeight);
//delet all the element in GraphicsContainer except the MapFrame
IGraphicsContainer pGraphicsContainer = activeView.GraphicsContainer;
IMap pMap = activeView.FocusMap;
//现有的mxd文档
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame; pGraphicsContainer.Reset();
IElement pElement = pGraphicsContainer.Next();
while (pElement != null)
{
if (pElement is IMapFrame)
{
//模板的
IMapFrame pTempMapFrame = (pTempPageLayout as IGraphicsContainer).FindFrame((pTempPageLayout as IActiveView).FocusMap) as IMapFrame;
IElement pTempElement = pTempMapFrame as IElement;
pElement.Geometry = pTempElement.Geometry;
pMapFrame.Border = pTempMapFrame.Border; //方里网
IMapGrids pMapGrids = pMapFrame as IMapGrids;
pMapGrids.ClearMapGrids();
IMapGrids tempGrids = pTempMapFrame as IMapGrids;
for (int i = ; i < tempGrids.MapGridCount; i++)
{
pMapGrids.AddMapGrid(tempGrids.get_MapGrid(i));
}
}
//else
//{
// pGraphicsContainer.DeleteElement(pElement);
//}
pElement = pGraphicsContainer.Next();
} //add element in the template to your cuurent pagelayout
IGraphicsContainer pTempGraCon = pTempPageLayout as IGraphicsContainer;
pTempGraCon.Reset();
pElement = pTempGraCon.Next();
while (pElement != null)
{
if (pElement is IMapFrame)
{
pElement = pTempGraCon.Next();
continue;
}
else if (pElement is IMapSurroundFrame)
{
IMapSurroundFrame pTempMapSurroundFrame = pElement as IMapSurroundFrame;
pTempMapSurroundFrame.MapFrame = pMapFrame;
IMapSurround pTempMapSurround = pTempMapSurroundFrame.MapSurround;
pMap.AddMapSurround(pTempMapSurround);
pGraphicsContainer.AddElement(pTempMapSurroundFrame as IElement, );
}
else
{
pGraphicsContainer.AddElement(pElement, );
}
pElement = pTempGraCon.Next();
}
} /// <summary>
/// 为PageLayout对象添加经纬网格
/// </summary>
/// <param name="pPageLayout"></param>
///
private void CreateGraticuleMapGrid(IPageLayout pPageLayout)
{
//获取MapFrame对象
IActiveView pAcitiveView = pPageLayout as IActiveView;
IMap pMap = pAcitiveView.FocusMap;
IGraphicsContainer pGraphicsContainer = pAcitiveView as IGraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame; IRgbColor rgbColor = new RgbColor(); IMapGrids pMapGrids;
IMapGrid pMapGrid; //Create the grid
pMapGrid = new GraticuleClass();// (IGraticule)pServerContext.CreateObject("esriCarto.Graticule");
pMapGrid.Name = "Map Grid"; rgbColor.Red = ;
rgbColor.Green = ;
rgbColor.Blue = ;
IColor color = rgbColor as IColor; //Set the line symbol used to draw the grid
ICartographicLineSymbol pLineSymbol;
pLineSymbol = new CartographicLineSymbolClass();
//pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
pLineSymbol.Width = ;
pLineSymbol.Color = color; pMapGrid.LineSymbol = pLineSymbol;
pMapGrid.Border = null; // clear the default border; //Set the Tick Properties
pMapGrid.TickLength = ;
pLineSymbol = new CartographicLineSymbolClass();
//pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
pLineSymbol.Width = ;
pLineSymbol.Color = color;
pMapGrid.TickLineSymbol = pLineSymbol;
pMapGrid.TickMarkSymbol = null; //clear the default
pMapGrid.LabelFormat.Font.Size = ; //Set the Sub Tick Properties
pMapGrid.SubTickCount = ;
pMapGrid.SubTickLength = ;
pLineSymbol = new CartographicLineSymbolClass();
//pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
pLineSymbol.Width = 0.1;
pLineSymbol.Color = color;
pMapGrid.SubTickLineSymbol = pLineSymbol; //Marshal.ReleaseComObject(pLineSymbol); //Set the Grid labels properties
IGridLabel pGridLabel;
pGridLabel = pMapGrid.LabelFormat;
pGridLabel.LabelOffset = ; stdole.StdFont pFont = new stdole.StdFont();
pFont.Name = "Arial";
pFont.Size = ; pMapGrid.LabelFormat.Font = pFont as stdole.IFontDisp; //Set the Tick, SubTick, Label Visibility along the 4 sides of the grid
pMapGrid.SetTickVisibility(true, true, true, true);
pMapGrid.SetSubTickVisibility(true, true, true, true);
pMapGrid.SetLabelVisibility(true, true, true, true); //Make map grid visible, so it gets drawn when Active View is updated
pMapGrid.Visible = true; //Set the IMeasuredGrid properties
IMeasuredGrid pMeasuredGrid;
pMeasuredGrid = pMapGrid as IMeasuredGrid;
pMeasuredGrid.FixedOrigin = true;
pMeasuredGrid.XIntervalSize = 0.5; //meridian interval
pMeasuredGrid.XOrigin = ; //shift grid 5
pMeasuredGrid.YIntervalSize = 0.5; //parallel interval
pMeasuredGrid.YOrigin = ; //shift grid 5 // add mapg grid to Layout and refresh
pMapGrids = pMapFrame as IMapGrids;
pMapGrids.AddMapGrid(pMapGrid);
} string aaa = @"C:\Users\Administrator\Desktop\bbbbbbb.mxd";
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.Open(aaa); string file = @"C:\Users\Administrator\Desktop\A90_90.mxt";
IMapDocument pMapDocument2 = new MapDocumentClass();
pMapDocument2.Open(file);//template's path changLayoutTemp2(pMapDocument.ActiveView, pMapDocument.PageLayout, pMapDocument2.PageLayout);
pMapDocument.SaveAs("d:\\aa7.mxd", true, true);

change_layout

backup3的更多相关文章

  1. backup3:master 数据库的备份和还原

    在SQL Server 中,master 数据库记录系统级别的元数据,例如,logon accounts, endpoints, linked servers, and system configur ...

  2. 工行ICBC_WAPB_B2C支付接口

    一. 前期准备 手机银行(WAP)B2C在线支付接口说明V1.0.0.6.doc 手机银行移动生活商户及门户网站js接口API.doc 支付组件ICBCEBankUtil.dll和infosecapi ...

  3. Linux下不同服务器间数据传输--转载

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  4. Linux下不同服务器间数据传输

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  5. linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl)(zz)

    linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl) 分类: linux2011-10-10 13:21 8773人阅读 评论(1) 收藏 举 ...

  6. Windows下ELK环境搭建(单机多节点集群部署)

    1.背景 日志主要包括系统日志.应用程序日志和安全日志.系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时 ...

  7. Mysql的实时同步 - 双机互备

    设置方法: 步一设 A 服务服 (192.168.1.43) 上用户为 backup, 123456 , 同步的数据库为test; B 服务服 (192.168.1.23) 上用户为 root, 12 ...

  8. MySQL学习总结(摘抄)

    1.数据库概述 简 而言之,数据库(DataBase)就是一个存储数据的仓库.为了方便数据的存储和管理,将数据按照特定的规律存储在磁盘上.通过数据库管理系统,可以有 效的组织和管理存储在数据库中的数据 ...

  9. MYSQL集群的搭建

    按照此配置完全可以配置成功!! 一.介绍========测试环境:Server1:ndbd 192.168.1.225Server2:ndbd 192.168.1.226Server3:mysqld ...

随机推荐

  1. MIT JOS学习笔记02:kernel 01(2016.10.28)

    未经许可谢绝以任何形式对本文内容进行转载! 在文章开头不得不说的是,因为这部分的代码需要仔细理清的东西太多,所以导致这篇分析显得很啰嗦,还请谅解. 我们在上一篇文章已经分析了Boot Loader的功 ...

  2. Win32隐藏输出console窗口

    #include <Windows.h> void HideConsole() { ::ShowWindow(::GetConsoleWindow(), SW_HIDE); } void ...

  3. 打算从oschina的博客搬运到cnblog了

    如题,感觉cnblog似乎要更加专业一点,顺便也禁水.提高下文章质量 以后就都是干货了 oschina原址 顺便庆祝一下Windows Live Writer配置成功

  4. esxi 升级

    开启ssh esxcli software vib install -d="/vmfs/volumes/53034105-a8b88330-c096-40f2e993407b/update- ...

  5. [原创]cocos2d-x研习录-第三阶 背景音乐和音效

    在游戏中,音效是一个不可或缺的部分,它可以为我们的游戏增加效果.音效在游戏中一般分为长时间的背景音乐和短促的特效音乐.Cocos2D-x支持多种常见音乐格式(mp3.wav等). Cocos2D-x提 ...

  6. 使用keepalived实现mysql主从复制的自动切换

    最近测试了一下mysql+keepalived实现主从自动切换,主从都需要安装keepalived,使用vip漂移实现主从自动切换,这里主要记录的是keepalived的文件配置. 这里mysql搭建 ...

  7. canvas关于getImageData跨域问题解决方法

    一.问题:在使用html5的canvas是,当用到getImageData方法获取图片信息时,会碰到跨域无法获取的情况,代码如下: document.getElementById("pic& ...

  8. 获取ICommand的图片

    BarButtonItem item = (BarButtonItem)e.Item; System.IntPtr _Handle = (System.IntPtr)(cmd as ICommand) ...

  9. .NET微信公众号开发-6.0模板消息

    一.前言 为了保证用户不受到骚扰,在开发者出现需要主动提醒.通知用户时,才允许开发者在公众平台网站中模板消息库中选择模板,选择后获得模板ID,再根据模板 ID向用户主动推送提醒.通知消息.这个意思也就 ...

  10. [2014.01.27]WFsoft.wfLibrary.wfVerifyImage 1.8

    全新开发的验证码图片控件--WFsoft.wfLibrary.wfVerifyImage,使用简单,功能强大.     完全支持.net 2.0编写,对下一代操作系统平稳过渡.     同时支持.ne ...