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. python基础篇

    python脚本开头 #!/usr/bin/env python# -*- coding: utf-8 -*print "你好,世界" 不要问为什么,记住就好了 变量定于的规则 变 ...

  2. requestAnimationFrame

    (function() { var lastTime = 0; var vendors = ['webkit', 'moz']; for(var x = 0; x < vendors.lengt ...

  3. Android AsyncTask 简单用法

    简介 AsyncTask 是一个轻量级的异步处理类.使用是需继承自该类.可以方便的执行异步任务并且在将进度显示在UI上. 注意事项 AsyncTask只适合处理轻量级的任务即耗时几秒或者几十秒的任务. ...

  4. Apache虚拟机建立本地域名

    Apache虚拟机建立本地域名 1.首先打开conf文件夹下http.conf文件,查找vhost,如下操作 2.删除#(取消注释,启用虚拟机功能),根据红框内路径找到httpd-vhosts.con ...

  5. javascript跨域、iframe跨域访问

    1.window 对象 浏览器会在其打开一个 HTML 文档时创建一个对应的 window 对象.但是,如果一个文档定义了一个或多个框架(即,包含一个或多个 frame 或 iframe 标签),浏览 ...

  6. Python之路,day6-Python基础

    1.config 模块 import configparser conf = configparser.ConfigParser() conf[', 'Compression': 'yes', '} ...

  7. build配置

     buildTypes {         debug {             // 显示Log             buildConfigField "boolean", ...

  8. JAVA课程体系

    文件流 单点登录 maven.maven私服 jenkins 小程序 支付 webservice/webapi redis 工作流 权限:shiro 高并发 springBoot dubbo 消息推送 ...

  9. C++中一个常用的句型(两个for(;;)语句连用的重要性)

    在一些简单的C++编程中,经常会用到两个for(;;)语句连用的情况,这是一个常用句型,因此感觉也非常重要.下面举两个例子说明一下: 例1.用两个for(;;)语句来进行数组元素大小的排序 #incl ...

  10. 定制个性化码表技术 ibus

    在不同用户的工作环境中,都会根据各自使用的字符集的不同,而需要定制优化各自的输入法码表,例如,在GB18030中的大量汉字,或许因为输入法码表的老旧,而难于利用自己熟悉的“五笔”方法快速录入,同样,需 ...