|
|
网上搜的,都是差不多的代码,但是这种方式对于 栅格图层,鹰眼控件被全部覆盖了,如图。
代码为,
- <P>IEnvelope enNew = (IEnvelope)e.newEnvelope;
- IGraphicsContainer hawkGC = (IGraphicsContainer)map_hawk_con.Map;
- IActiveView aView = (IActiveView)hawkGC;
- hawkGC.DeleteAllElements();</P>
- <P> IElement recEle = (IElement)new RectangleElementClass();
- recEle.Geometry = enNew;</P>
- <P> IRgbColor rgb = new RgbColorClass();
- rgb.RGB = 255;
- rgb.Transparency = 255;</P>
- <P> ILineSymbol line = new SimpleLineSymbolClass();
- line.Width = 2;
- line.Color = rgb;</P>
- <P> rgb = new RgbColorClass();
- rgb.RGB = 255;
- rgb.Transparency = 0;</P>
- <P> IFillSymbol fillSym = new SimpleFillSymbolClass();
- fillSym.Outline = line;
- fillSym.Color = rgb;</P>
- <P> IFillShapeElement fillShp = (IFillShapeElement)recEle; //我自己认为因为这里是 Shape填充,所以对栅格图层有问题
- fillShp.Symbol = fillSym;
- hawkGC.AddElement((IElement)fillShp, 0);
- aView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);</P>
复制代码
|
|