你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
朱新颖
赞同来自:
IPageLayout pageLayout = axPageLayoutControl1.PageLayout; IActiveView activeView = (IActiveView)pageLayout; IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer; graphicsContainer.Reset(); IElement element = graphicsContainer.Next(); while (element != null) { if (element is IMapSurroundFrame) { IMapSurround mapSurround = ((IMapSurroundFrame)element).MapSurround; if (mapSurround is ILegend) { ILegend legend = (ILegend)mapSurround; IGraphicsComposite graphComp = (IGraphicsComposite)legend; IEnumElement enumElem = graphComp.get_Graphics(activeView.ScreenDisplay, element.Geometry.Envelope); enumElem.Reset(); IElement ele = enumElem.Next(); while(ele !=null) { graphicsContainer.AddElement(ele,0);//可以将其添加到当前PageLayout里 ele = enumElem.Next(); } } } element = graphicsContainer.Next(); } }
要回复问题请先登录或注册
1 个回复
朱新颖
赞同来自:
1,获取ILegend;
2,将ILegend转为IGraphicsComposite,执行get_Graphics()方法即可。
要回复问题请先登录或注册