首页 > Windows开发 > 详细

AE+C# 向axPageLayoutControl1添加图例

时间:2016-10-31 21:30:40      阅读:820      评论:0      收藏:0      [点我收藏+]

原文 AE+C# 向axPageLayoutControl1添加图例

 

//Get the GraphicsContainer
IGraphicsContainer graphicsContainer = axPageLayoutControl1.GraphicsContainer;

//Get the MapFrame
IMapFrame mapFrame = (IMapFrame)graphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap);
if (mapFrame == null) return;

//Create a legend
UID uID = new UIDClass();
uID.Value = "esriCarto.Legend";

//Create a MapSurroundFrame from the MapFrame
IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uID, null);
if (mapSurroundFrame == null) return;
if (mapSurroundFrame.MapSurround == null) return;
//Set the name 
mapSurroundFrame.MapSurround.Name = "Legend";

//Envelope for the legend
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(1, 1, 3.4, 2.4);

//Set the geometry of the MapSurroundFrame 
IElement element = (IElement)mapSurroundFrame;
element.Geometry = envelope;

//Add the legend to the PageLayout
axPageLayoutControl1.AddElement(element, Type.Missing, Type.Missing, "Legend", 0);

//Refresh the PageLayoutControl
axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

 

AE+C# 向axPageLayoutControl1添加图例

原文:http://www.cnblogs.com/arxive/p/6017177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!