sharpened

Is there anything can be done to improve the performance of my Hawkeye map?

Discussion created by sharpened on Oct 4, 2013
My code is gonna below:
private void EagleEye_Load(object sender, EventArgs e) {
            toolbar.SetBuddyControl(map_main.Object);
            toc.SetBuddyControl(map_main.Object);
        }
        #region Even on Main map
        //Update extend map.
        private void map_main_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e) {
            IRgbColor rgb = new RgbColorClass();  //The color of the Outline.
            rgb.Red = 255;
            rgb.Green = 0;
            rgb.Blue = 0;
            rgb.Transparency = 255;

            ISimpleLineSymbol outLine = new SimpleLineSymbolClass();   //The outline.
            outLine.Color = rgb;
            outLine.Width = 3;  //The width of the outline.

            rgb = new RgbColorClass();  //The fill color.
            rgb.Red = 255;
            rgb.Green = 0;
            rgb.Blue = 0;
            rgb.Transparency = 0;

            ISimpleFillSymbol fill = new SimpleFillSymbolClass();   //The fill style.
            fill.Outline = outLine;
            fill.Color = rgb;

            IRectangleElement rectangle = new RectangleElementClass();  //The selection element.
            IElement rectangleElement = rectangle as IElement;
            IFillShapeElement shape = rectangleElement as IFillShapeElement;
            shape.Symbol = fill;
            rectangleElement.Geometry = (IEnvelope)e.newEnvelope;

            IGraphicsContainer mapContainer = map_eagle.Map as IGraphicsContainer;
            mapContainer.DeleteAllElements();   //Delete elements in the hawkeye map.
            mapContainer.AddElement((IElement)shape, 0);
            IActiveView view = mapContainer as IActiveView;
            view.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
        //Replace map.
        private void map_main_OnMapReplaced(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e) {
            map_eagle.Map.AddLayer(this.GetOverviewLayer(map_main.Map));
            map_eagle.Extent = map_main.FullExtent;
            map_eagle.ActiveView.Refresh();
        }

        private void map_main_OnFullExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnFullExtentUpdatedEvent e) {
            map_eagle.Map.AddLayer(this.GetOverviewLayer(map_main.Map));
            map_eagle.Extent = map_main.FullExtent; //Change the hawkeye map extent as the main map.
            map_eagle.Refresh();
        }
        #endregion

        #region Even on Halkeye map.
        private void map_eagle_OnMouseMove(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e) {
            if(e.button == 1) {
                IPoint p = new PointClass();
                p.PutCoords(e.mapX, e.mapY);
                map_main.CenterAt(p);
                map_main.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
        }

        private void map_eagle_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) {
            if(map_main.LayerCount > 0) {   //Has layer.
                if(e.button == 1) { //Left click.
                    IPoint p = new PointClass();
                    p.PutCoords(e.mapX, e.mapY);
                    map_main.CenterAt(p);
                }
                else if(e.button == 2) {    //Right click.
                    map_main.Extent = map_eagle.TrackRectangle();
                }
                else throw new ArgumentNullException("???????????!");
                map_main.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
        }
        #endregion

        /// <summary>
        /// Get the maxnum extent layer.
        /// </summary>
        /// <param name="map">The map that contains the layers..</param>
        /// <returns>the maxnum extent layer</returns>
        private ILayer GetOverviewLayer(IMap map) {
            if(map.LayerCount <= 0) throw new ArgumentNullException("None layer!");
            ILayer maxLayer = map.get_Layer(0);
            for(int i = 1; i < map.LayerCount; i++) {
                if(map.get_Layer(i).AreaOfInterest.Width > maxLayer.AreaOfInterest.Width)
                    maxLayer = map.get_Layer(i);
            }
            return maxLayer;
        }


It seems that I refresh so much or someting else,and I always want to search for improving the performance.
Could you launch someting? Thanks very much.

Outcomes