pMap = axMapControl1.Map;
pActiveView = pMap as IActiveView;
pEnv = axMapControl1.TrackRectangle();
enumelement = pGraphicsContainer.LocateElementsByEnvelope(pEnv);
IElement ele1 = enumelement.Next();
IElement ele2 = enumelement.Next();
ITopologicalOperator topologicalOperator = (ITopologicalOperator)ele1.Geometry;
topologicalOperator.Simplify();
(ele2.Geometry as ITopologicalOperator).Simplify();
IGeometry unionGeometry = topologicalOperator.Union(ele2.Geometry);
IElement unionElement = new PolygonElementClass { Geometry = unionGeometry };
axMapControl1.ActiveView.GraphicsContainer.AddElement(unionElement, 0);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
在地图控件中自己添加了两个多边形,在使用union方法合并时报错,在网上看到说是图形未简化处理,但在用Simplify方法简化后还是报错。