private void axPageLayoutControl1_OnExtentUpdated(object sender, IPageLayoutControlEvents_OnExtentUpdatedEvent e)
        {
            //QI for IEnvelope
            IEnvelope envelope = (IEnvelope)e.newEnvelope;

            //Get the IElement interface by finding an element by its name
            IElement element = m_PageLayoutControl.FindElementByName("ZoomExtent", 1);

            if (element != null)
            {
                //Delete the graphic
                m_PageLayoutControl.GraphicsContainer.DeleteElement(element);
            }
            element = new RectangleElementClass();

            //Get the IRGBColor interface
            IRgbColor color = new RgbColorClass();

            //Set the color properties
            color.RGB          = 255;
            color.Transparency = 255;

            //Get the ILine symbol interface
            ILineSymbol outline = new SimpleLineSymbolClass();

            //Set the line symbol properties
            outline.Width = 10;
            outline.Color = color;

            //Set the color properties
            color              = new RgbColorClass();
            color.RGB          = 255;
            color.Transparency = 0;

            //Get the IFillSymbol properties
            IFillSymbol fillSymbol = new SimpleFillSymbolClass();

            //Set the fill symbol properties
            fillSymbol.Color   = color;
            fillSymbol.Outline = outline;

            //QI for IFillShapeElement interface through the IElement interface
            IFillShapeElement fillShapeElement = (IFillShapeElement)element;

            //Set the symbol property
            fillShapeElement.Symbol = fillSymbol;

            //Add the element
            m_PageLayoutControl.AddElement(element, e.newEnvelope, Type.Missing, "ZoomExtent", -1);
            //Refresh the graphics
            m_PageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, Type.Missing);
        }
        private void axPageLayoutControl1_OnExtentUpdated(object sender, IPageLayoutControlEvents_OnExtentUpdatedEvent e)
        {
            //QI for IEnvelope
            IEnvelope envelope = (IEnvelope)e.newEnvelope;

            //Get the IElement interface by finding an element by its name 
            IElement element = m_PageLayoutControl.FindElementByName("ZoomExtent", 1);
            if (element != null)
            {
                //Delete the graphic
                m_PageLayoutControl.GraphicsContainer.DeleteElement(element);
            }
            element = new RectangleElementClass();

            //Get the IRGBColor interface
            IRgbColor color = new RgbColorClass();
            //Set the color properties
            color.RGB = 255;
            color.Transparency = 255;

            //Get the ILine symbol interface
            ILineSymbol outline = new SimpleLineSymbolClass();
            //Set the line symbol properties
            outline.Width = 10;
            outline.Color = color;

            //Set the color properties
            color = new RgbColorClass();
            color.RGB = 255;
            color.Transparency = 0;

            //Get the IFillSymbol properties
            IFillSymbol fillSymbol = new SimpleFillSymbolClass();
            //Set the fill symbol properties
            fillSymbol.Color = color;
            fillSymbol.Outline = outline;

            //QI for IFillShapeElement interface through the IElement interface
            IFillShapeElement fillShapeElement = (IFillShapeElement)element;
            //Set the symbol property
            fillShapeElement.Symbol = fillSymbol;

            //Add the element
            m_PageLayoutControl.AddElement(element, e.newEnvelope, Type.Missing, "ZoomExtent", -1);
            //Refresh the graphics
            m_PageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics, Type.Missing, Type.Missing);
        }