欢迎来到天天文库
浏览记录
ID:13950986
大小:52.00 KB
页数:3页
时间:2018-07-25
《添加比例尺 指北针》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、添加图例、比例尺、指北针代码中有注释,直接上指北针C#代码1publicvoidAddNorthArrow(IPageLayoutpageLayout)2{3IGraphicsContainercontainer=pageLayoutasIGraphicsContainer;4IActiveViewactiveView=pageLayoutasIActiveView;5//获得MapFrame6IFrameElementframeElement=container.FindFrame(activeView.FocusMap);7IMapFramemapFrame=frameElement
2、asIMapFrame;8//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround9UIDuid=newUIDClass();10uid.Value="esriCarto.MarkerNorthArrow";11IMapSurroundFramemapSurroundFrame=mapFrame.CreateSurroundFrame(uid,null);12//设置MapSurroundFrame中指北针的点符号13IMapSurroundmapSurround=mapSurroundFrame.MapSurround;14IMarke
3、rNorthArrowmarkerNorthArrow=mapSurroundasIMarkerNorthArrow;15IMarkerSymbolmarkerSymbol=markerNorthArrow.MarkerSymbol;16markerSymbol.Size=18;17markerNorthArrow.MarkerSymbol=markerSymbol;18//QI,确定mapSurroundFrame的位置19IElementelement=mapSurroundFrameasIElement;20IEnvelopeenvelope=newEnvelopeClass();
4、21envelope.PutCoords(0.2,0.2,5,5);22element.Geometry=envelope;23//使用IGraphicsContainer接口添加显示24container.AddElement(element,0);25activeView.Refresh();26}比例尺C#代码27publicvoidAddScalebar(IPageLayoutpageLayout)28{1IGraphicsContainercontainer=pageLayoutasIGraphicsContainer;2IActiveViewactiveView=pageLa
5、youtasIActiveView;3//获得MapFrame4IFrameElementframeElement=container.FindFrame(activeView.FocusMap);5IMapFramemapFrame=frameElementasIMapFrame;6//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround7UIDuid=newUIDClass();8uid.Value="esriCarto.AlternatingScaleBar";9IMapSurroundFramemapSurroundFrame=m
6、apFrame.CreateSurroundFrame(uid,null);10//设置MapSurroundFrame中比例尺的样式11IMapSurroundmapSurround=mapSurroundFrame.MapSurround;12IScaleBarmarkerScaleBar=((IScaleBar)mapSurround);13markerScaleBar.LabelPosition=esriVertPosEnum.esriBelow;14markerScaleBar.UseMapSettings();15//QI,确定mapSurroundFrame的位置16IEl
7、ementelement=mapSurroundFrameasIElement;17IEnvelopeenvelope=newEnvelopeClass();18envelope.PutCoords(0.2,0.2,1,2);19element.Geometry=envelope;20//使用IGraphicsContainer接口添加显示21container.AddElement(element,0);22activeView.
此文档下载收益归作者所有