示例#1
0
        private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            //创建鹰眼中线框
            IEnvelope         pEnv          = (IEnvelope)e.newEnvelope;
            IRectangleElement pRectangleEle = new RectangleElementClass();
            IElement          pEle          = pRectangleEle as IElement;

            pEle.Geometry = pEnv;

            //设置线框的边线对象,包括颜色和线宽
            IRgbColor pColor = new RgbColorClass();

            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 255;
            // 产生一个线符号对象
            ILineSymbol pOutline = new SimpleLineSymbolClass();

            pOutline.Width = 2;
            pOutline.Color = pColor;

            // 设置颜色属性
            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 0;

            // 设置线框填充符号的属性
            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();

            pFillSymbol.Color   = pColor;
            pFillSymbol.Outline = pOutline;
            IFillShapeElement pFillShapeEle = pEle as IFillShapeElement;

            pFillShapeEle.Symbol = pFillSymbol;

            // 得到鹰眼视图中的图形元素容器
            IGraphicsContainer pGra = axMapControl2.Map as IGraphicsContainer;
            IActiveView        pAv  = pGra as IActiveView;

            // 在绘制前,清除 axMapControl2 中的任何图形元素
            pGra.DeleteAllElements();
            // 鹰眼视图中添加线框
            pGra.AddElement((IElement)pFillShapeEle, 0);
            // 刷新鹰眼
            pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#2
0
        private void axMapControl_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            IEnvelope          pEnvelope          = (IEnvelope)e.newEnvelope;
            IGraphicsContainer pGraphicsContainer = axMapControl2.Map as IGraphicsContainer;
            IActiveView        pActiveView        = pGraphicsContainer as IActiveView;

            pGraphicsContainer.DeleteAllElements();
            IRectangleElement pRectangleEle = new RectangleElementClass();
            IElement          pElement      = pRectangleEle as IElement;

            pElement.Geometry = pEnvelope;

            IRgbColor pColor = new RgbColorClass();

            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 255;

            ILineSymbol pOutline = new SimpleLineSymbolClass();

            pOutline.Width      = 3;
            pOutline.Color      = pColor;
            pColor              = new RgbColorClass();
            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 0;

            IFillSymbol pFillSymbol = new SimpleFillSymbolClass();

            pFillSymbol.Color   = pColor;
            pFillSymbol.Outline = pOutline;
            IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;

            pFillShapeEle.Symbol = pFillSymbol;
            pGraphicsContainer.AddElement((IElement)pFillShapeEle, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#3
0
        private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
        {
            IEnvelope          envelope          = (IEnvelope)e.newEnvelope;
            IGraphicsContainer graphicsContainer = axMapControl2.Map as IGraphicsContainer;
            IActiveView        activeView        = graphicsContainer as IActiveView;

            graphicsContainer.DeleteAllElements();
            IElement element = new RectangleElement();

            element.Geometry = envelope;
            ILineSymbol outLineSymbol = new SimpleLineSymbol();

            outLineSymbol.Width = 2;
            outLineSymbol.Color = GetColor(0, 150, 200, 230);
            IFillSymbol fillSymbol = new SimpleFillSymbol();

            fillSymbol.Color   = GetColor(9, 0, 0, 0);
            fillSymbol.Outline = outLineSymbol;
            IFillShapeElement fillShapeElement = element as IFillShapeElement;

            fillShapeElement.Symbol = fillSymbol;
            graphicsContainer.AddElement((IElement)fillShapeElement, 0);
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
示例#4
0
 private void axMapControl1_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e)
 {
 }