《2.3layoutelements.ppt》由会员分享,可在线阅读,更多相关《2.3layoutelements.ppt(11页珍藏版)》请在三一办公上搜索。
1、2.3 Working with layout elements,12-2,Lesson overview,增加框架元素到PageLayout使用 graphics container符号化回顾SymbolsColorsElements打印和输出布局,12-3,对象模型图,ArcMap OMD,12-4,回顾:Elements,有一些可以创建的对象图形元素包含Line,polygon,markerText and pictures框架元素 在 PageLayout上Map framesNorth arrows,legends,scale barsTable frames,12-5,框架元素Fr
2、ameElements,属于 PageLayout 的附属MapSurroundFrame elementsMapSurrounds对象的容器(e.g.,Scalebars)内容时动态更新的,MapSurroundFrame,MapSurround,12-6,例子:在布局上引用MapFrames对象,Dim pMxDoc As IMxDocumentSet pMxDoc=ThisDocumentDim pGC As IGraphicsContainer枚举对象Set pGC=pMxDoc.PageLayoutpGC.Reset 移动到最前面Dim pElem As IElementSet pE
3、lem=pGC.Next 取得第一个条目Do Until pElem Is NothingIf(TypeOf pElem Is IMapFrame)Then 有多种类型 Dim pMapEnvelope As IEnvelope Dim intW As Integer,intH As Integer Set pMapEnvelope=pElem.Geometry.EnvelopeintW=pMapEnvelope.WidthintH=pMapEnvelope.Height MsgBox Map Frame=&intW&by&intH End IfSet pElem=pGC.Next 取得下一个
4、条目Loop,12-7,打印一个a layout,多样的输出子类EmfPrinter(增强的 meta-file)PsPrinter(支持打印机脚本)ArcPressPrinterPaper class用来管理打印纸张设置发送到打印机或者是文件,12-8,输出 layout对象,多样化的输出格式Adobe Acrobat(*.pdf)JPEGArcPress使用的IActiveView方法StartExporting输出聚焦的Map或PageLayout,12-9,例子:把Layout输出到一个Jpg文件,Private Sub Export(aLayout As IActiveView,aP
5、ath As String,DPI As Integer)Dim rectOut As tagRECT rectOut=aLayout.exportFrame Dim pExporter As IExporter Set pExporter=New JpegExporter Dim pEnv As IEnvelope Set pEnv=New Envelope pEnv.PutCoords rectOut.Left,rectOut.Top,rectOut.Right,rectOut.bottom pExporter.ExportFileName=aPath pExporter.PixelBou
6、nds=pEnv pExporter.Resolution=DPI,12-10,例子:把Layout输出到一个Jpg文件,Recalc the export frame to handle the increased number of pixels Set pEnv=pExporter.PixelBounds Dim xMin As Double,yMin As Double,xMax As Double,yMax As Double pEnv.QueryCoords xMin,yMin,xMax,yMax rectOut.Left=xMin rectOut.Top=yMin rectOut
7、.Right=xMax rectOut.bottom=yMax Dim hDc As Long hDc=pExporter.StartExporting aLayout.Output hDc,DPI,rectOut,Nothing,Nothing pExporter.FinishExporting MsgBox Export complete!,vbInformationEnd Sub,12-11,考试题目,1、建立一个UIButtonControl,单击该按钮,加载磁盘上C:USAStates.shp的 ShapeFile文件到ArcMap的地图中。2、建立一个UIToolControl,使用该工具时,可以点选其中一个多边形对象,并把选择中记录的序号为6的字段值显示出来。3、最后的结果是:,