现在的位置: 首页 > 综合 > 正文

做鹰眼图

2014年03月04日 ⁄ 综合 ⁄ 共 1622字 ⁄ 字号 评论关闭
private void axMapControl1_OnExtentUpdated_1(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            // 得到新范围

            IEnvelope pEnv = (IEnvelope)e.newEnvelope;
            IGraphicsContainer pGra = axMapControl2.Map as IGraphicsContainer;
            IActiveView pAv = pGra as IActiveView;
            
            //在绘制前,清除axMapControl2中的任何图形元素
            pGra.DeleteAllElements();
            IElement pEle = new RectangleElementClass();
            pEle.Geometry = pEnv;
            

            //设置鹰眼图中的红线
            //产生一个线符号对象
            ILineSymbol pOutline = new SimpleLineSymbolClass();
            pOutline.Width = 2;
            pOutline.Color = GetColor(255, 0, 0,255);
            //设置颜色属性
            //设置填充符号的属性
            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();
            pFillSymbol.Color = GetColor(9, 0, 0, 0);
            pFillSymbol.Outline = pOutline;
            IFillShapeElement pFillShapeEle = pEle as IFillShapeElement;
            pFillShapeEle.Symbol = pFillSymbol;
            pGra.AddElement((IElement)pFillShapeEle, 0);
            pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }

private void axMapControl2_OnMouseDown(object sender, ESRI.ArcGIS.MapControl.IMapControlEvents2_OnMouseDownEvent e)
        {
            IPoint pPt = new PointClass();

            pPt.PutCoords(e.mapX, e.mapY);

            axMapControl1.CenterAt(pPt);
            

        }

private IRgbColor GetColor(int r,int g,int b,int t)
        {
            IRgbColor pc = new RgbColorClass();
            pc.Red = r;
            pc.Green = g;
            pc.Blue = b;
            pc.Transparency = (byte)t ;
            return pc;
        }

 

抱歉!评论已关闭.