惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - GIS云中飞鹏

ArcGIS Server 9.3 REST基础教程 ArcGIS_系列视频教程::精品大放送 VS2005中删除最近打开的项目和文件的记录 [资源共享]C#+AE构建GIS桌面端应用系统框架-全代码 - GIS云中飞鹏 - 博客园 2008ESRI中国区域用户大会资料已经共享!!!^_^ 刻录机放入光盘,出现函数不正确的解决方法! ArcSDE初级教程下载 ArcIMS HTML Viewer开发经典教程:Customizing the HTML Viewer下载 “全国信息化工程师—GIS应用水平考试”考试复习资料下载! ArcObjects GIS应用开发——基于C#.NET--PDF下载 ArcGIS Unknown Spatial Reference问题解疑(转载) - GIS云中飞鹏 oracle 10g默认用户名、密码解锁 自己定制的SymbolSelectForm效果及VB.NET源码 用AE创建气泡式提示框的方法-VB.Net源码(转载) - GIS云中飞鹏 - 博客园 VS在Debug时检测到Loaderlock的解决办法 - GIS云中飞鹏 - 博客园 【ArcGIS Server 开发系列】Flyingis六大系列讲座精品PDF奉献 公司数据部培训讲义:ArcMap数字化培训教程 如何改变ArcIMS92图例字体大小中? - GIS云中飞鹏 - 博客园 在ArcGisEngine 开发中如何在Toolbar控件上添加Combobox等其他控件?
ArcGIS Engine 怎样给PageLayout替换模板
GIS云中飞鹏 · 2008-08-07 · via 博客园 - GIS云中飞鹏

                                         ArcGIS Engine 怎样给PageLayout替换模板

在打印出图时,常常需要更换已有的模板(mxt),这时数据并不改变。在ArcMap里面有一个替换模板的工具,但是在Engine里面却没有一个能直接替换模板的接口,而是需要读取新模板,取出模板里面的各个要素,然后替换掉原模板里面是相应要素。

Sub changelayout()
Dim pDoc As IMxDocument
Set pDoc = Application.Document
Dim pMap As IMap
Set pMap = pDoc.FocusMap
Dim pPageLayout As IPageLayout
Set pPageLayout = pDoc.PageLayout
'读取新模板
Dim pNewDoc As IMapDocument
Set pNewDoc = New MapDocument
pNewDoc.Open "C:Program FilesArcGISBinTemplatesLandscapeModern.mxt"
Dim pTempMap As IMap
Dim pTempPagelayout As IPageLayout
Set pTempPagelayout = pNewDoc.PageLayout
'Set pTempMap = pNewDoc.Map
Dim pTempPage As IPage
Set pTempPage = pTempPagelayout.Page

Dim pCurPage As IPage
Set pCurPage = pPageLayout.Page

'替换单位
pCurPage.Units = pTempPage.Units
'exchange page orientation
pCurPage.Orientation = pTempPage.Orientation
'替换页面尺寸
Dim dWidth As Double
Dim dHeight As Double
pTempPage.QuerySize dWidth, dHeight
pCurPage.PutCustomSize dWidth, dHeight

'删除当前Layout中除了mapframe外的所有elements
Dim pGraphicsCont As IGraphicsContainer
Dim pElement As IElement
Set pGraphicsCont = pPageLayout
pGraphicsCont.Reset
Set pElement = pGraphicsCont.Next
Do Until pElement Is Nothing
If TypeOf pElement Is IMapFrame Then
Dim pMapFrame As IMapFrame
Dim pMapFrameElement As IElement
Set pMapFrameElement = pElement
Set pMapFrame = pElement
Else
pGraphicsCont.DeleteElement pElement
pGraphicsCont.Reset
End If
Set pElement = pGraphicsCont.Next


Loop

'遍历模板的PageLayout中的所有元素,并且替换当前PageLayout中的所有元素
Dim pTempGraphicsCont As IGraphicsContainer
Set pTempGraphicsCont = pTempPagelayout
pTempGraphicsCont.Reset
Set pElement = pTempGraphicsCont.Next
Dim pArray As IArray
Set pArray = New esriSystem.Array
Do Until pElement Is Nothing
If TypeOf pElement Is IMapFrame Then
pMapFrameElement.Geometry = pElement.Geometry
Else
If TypeOf pElement Is IMapSurroundFrame Then
Dim pTempMapSurroundFrame As IMapSurroundFrame
Dim pTempMapSurround As IMapSurround
Set pTempMapSurroundFrame = pElement
Set pTempMapSurroundFrame.MapFrame = pMapFrame
Set pTempMapSurround = pTempMapSurroundFrame.MapSurround
pMap.AddMapSurround pTempMapSurround
End If
pArray.Add pElement
End If
Set pElement = pTempGraphicsCont.Next
Loop

Dim pElementCount As Long
pElementCount = pArray.Count
Dim i As Long
'将模板PageLayout中的其它元素(除了MapFrameElement和MapSurroundFrame外的元素)添加到当前PageLayout中去
For i = 0 To pElementCount - 1
pGraphicsCont.AddElement pArray.Element(pElementCount - 1 - i), 0
Next i
pDoc.ActiveView.Refresh

End Sub