参考代码
1: //获取绘制要素的整体范围
2: IEnumElement pEnumElem;
3: IGraphicsContainer graphicsContainer = pMap as IGraphicsContainer;
4: IGraphicsContainerSelect pGraphicsContainerSelect = pMap as IGraphicsContainerSelect;
5: pGraphicsContainerSelect.SelectAllElements();
6: pEnumElem = pGraphicsContainerSelect.SelectedElements;
7: IElement ele = pEnumElem.Next();
8: IEnvelope env = new EnvelopeClass();
9: while (ele != null)
10: {
11: IGeometry geo = ele.Geometry;
12: ele = pEnumElem.Next();
13: env.Union(geo.Envelope);
14: }
15: pActiveView.Extent = env;
16: pGraphicsContainerSelect.UnselectAllElements();
最后获取的env就是所需要的公共外接矩形。
参考文章: