首页 > 代码库 > AE+C# 向axPageLayoutControl1添加图例
AE+C# 向axPageLayoutControl1添加图例
原文 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添加图例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。