private void FlashFeature(IGeometry pGeometry)//目标闪烁 { esriGeometryType pGeometryType = pGeometry.GeometryType; ISymbol pSymbol = null; IColor pColor = new RgbColorClass(); pColor.RGB = 255; if (pGeometryType == esriGeometryType.esriGeometryPolygon) { ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass(); pSimpleFillSymbol.Color = pColor; pSymbol = pSimpleFillSymbol as ISymbol; } else if (pGeometryType == esriGeometryType.esriGeometryPolyline || pGeometryType == esriGeometryType.esriGeometryLine) { ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass(); pSimpleLineSymbol.Color = pColor; pSimpleLineSymbol.Width = 2; pSymbol = pSimpleLineSymbol as ISymbol; } else if (pGeometryType == esriGeometryType.esriGeometryPoint || pGeometryType == esriGeometryType.esriGeometryMultipoint) { ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass(); pSimpleMarkerSymbol.OutlineColor = pColor; pSimpleMarkerSymbol.OutlineSize = 2; pSymbol = pSimpleMarkerSymbol as ISymbol; } m_MapControl.FlashShape(pGeometry, 4, 200, pSymbol); }
/// <summary> /// 高亮IGeometry /// </summary> /// <param name="myAxMapControl">AxMapControl扩展对象</param> /// <param name="myIGeometry">需要高亮的IGeometry</param> /// <param name="myISymbol">高亮样式</param> public static void FlashIGeometry(this ESRI.ArcGIS.Controls.AxMapControl myAxMapControl, IGeometry myIGeometry, ISymbol myISymbol) { Timer myTimer = new Timer(); myTimer.Interval = 2000; myTimer.Start(); myTimer.Tick += (s, e) => { myTimer.Stop(); myAxMapControl.FlashShape(myIGeometry, 5, 100, myISymbol); }; }