主要是实现主窗口的OnExtentUpdate事件,首先获取鹰眼窗口的map作为activeView和GraphicContainer。然后在graphicContainer中画图,将画好的fillShapeElement加到graphicContainer中,最后更新activeView。
private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
{
ESRI.ArcGIS.Geometry.IEnvelope envelope = (ESRI.ArcGIS.Geometry.IEnvelope)e.newEnvelope;
ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = axMapControl2.Map as ESRI.ArcGIS.Carto.IGraphicsContainer;
ESRI.ArcGIS.Carto.IActiveView activeView = graphicsContainer as ESRI.ArcGIS.Carto.IActiveView;
graphicsContainer.DeleteAllElements();
ESRI.ArcGIS.Carto.IElement element = new ESRI.ArcGIS.Carto.RectangleElementClass();
element.Geometry = envelope;
ESRI.ArcGIS.Display.ILineSymbol outlineSymbol = new ESRI.ArcGIS.Display.Simpl