SoFunction
Updated on 2025-03-06

Detailed full process of making Hawkeye (with comments) example code of C#


private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e)

        {

 

// Get a new range

            IEnvelope pEnv = (IEnvelope);

 

            IGraphicsContainer pGra = as IGraphicsContainer;

            IActiveView pAv = pGra as IActiveView;

//Please clear any graphic element in axMapControl2 before drawing

            ();

 

            IRectangleElement pRectangleEle = new RectangleElementClass();

            IElement pEle = pRectangleEle as IElement;

            = pEnv;

 

//Set the red wireframe in the Hawkeye diagram

            IRgbColor pColor = new RgbColorClass();

            = 255;

            = 0;

            = 0;

            = 255;

//Create a line symbol object

            ILineSymbol pOutline = new SimpleLineSymbolClass();

            = 2;

            = pColor;

 

//Set color attributes

            pColor = new RgbColorClass();

            = 255;

            = 0;

            = 0;

            = 0;

//Set the properties of the fill symbol

            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();

            = pColor;

            = pOutline;

 

            IFillShapeElement pFillShapeEle = pEle as IFillShapeElement;

            = pFillSymbol;

            ((IElement)pFillShapeEle, 0);

            (, null, null);

        }