3种方式(围绕所选元素、围绕所有元素和在页边距之内)

讯享网
添加内图廓线的三种方式:

private void updateProperty() {
//添加整理图廓线 IEnvelope pEnvelope = new EnvelopeClass(); FrameElement pFrameElement = new FrameElementClass(); IFrameElement pIFrameElement = pFrameElement as IFrameElement; pIFrameElement.Border = new SymbolBorder(); if (radioOut.Checked) {
pEnvelope = pageLayoutControl.Page.PrintableBounds; } if(radioAll.Checked) {
IGroupElement pGroupElement = new GroupElementClass(); IGraphicsContainer pGraphicsContainer = pageLayoutControl.PageLayout as IGraphicsContainer; pGraphicsContainer.Reset(); IElement pElement = pGraphicsContainer.Next(); while (pElement != null) {
pGroupElement.AddElement(pElement); pElement = pGraphicsContainer.Next(); } if (pGroupElement.ElementCount != 0) {
//获取包含所有选择要素的最小矩形框 IElement pTagGroupElement = pGroupElement as IElement; pTagGroupElement.QueryBounds(pageLayoutControl.ActiveView.ScreenDisplay as IDisplay, pEnvelope); } } if(radioIn.Checked) {
IGroupElement pGroupElement = new GroupElementClass(); IGraphicsContainer pGraphicsContainer = pageLayoutControl.PageLayout as IGraphicsContainer; IGraphicsContainerSelect pGraphicsContainerSelect = pageLayoutControl.PageLayout as IGraphicsContainerSelect; IEnumElement pEnumElement = pGraphicsContainerSelect.SelectedElements; pEnumElement.Reset(); IElement pElement = pEnumElement.Next(); while (pElement != null) {
pGroupElement.AddElement(pElement); pElement = pEnumElement.Next(); } if (pGroupElement.ElementCount != 0) {
//获取包含所有选择要素的最小矩形框 IElement pTagGroupElement = pGroupElement as IElement; pTagGroupElement.QueryBounds(pageLayoutControl.ActiveView.ScreenDisplay as IDisplay, pEnvelope); } } try {
pFrameElement.Geometry = pEnvelope; //添加图廓线 pageLayoutControl.ActiveView.GraphicsContainer.AddElement(pFrameElement, 0); pageLayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } catch (System.Exception ex) {
MessageBox.Show("设置图廓线失败!" + ex.Message); } }
讯享网
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/91804.html