Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to flash many features at same time in ArcMap using C# coding?

Currently I call this function in a loop,

private void FlashFeature(IActiveView _activeView, IFeature _feature)
    IActiveView activeView = _activeView;
    IFeatureIdentifyObj featIdentify = new FeatureIdentifyObject();
    featIdentify.Feature = _feature;
    IIdentifyObj identify = featIdentify as IIdentifyObj;

but unfortunately it flashes one feature at a time, and while flashing is happening it holds the process. As a result of that it flashes around 2 features in a second, instead of them all at once. I also want to flash thous features without changing my curent feature selection in map, if posable. The default ArcMap Find tool(form or whatever it is) can do it, and i'm trying to find a way to implement that in my tool.

share|improve this question
I removed my answer--so many stupid things in that class that I decided to drop it. One of the issues that I had was when I was flashing coincident geometries, their symbols would cancel each other out (due to the esriROPNotXOrPen raster operation). So it looked like it was doing nothing (had me stumped for quite a while). Also, I found this:… which I think I used when I built my class. It might be better to start with it and tweak it to handle multiple geoms. – Jay Cummins Aug 2 '12 at 14:03
Thanks. Ok I'll look into it. – Sunder Aug 2 '12 at 14:15
up vote 4 down vote accepted

Please see my customized flash routine in the answer to this question: ESRI Flash Command in custom code

I think this will work for you as it accepts GeometryBags along with Polygon, Polyline, Point and Multipoint geometries. It does not union the geometries but draws each one individually.

Alternatively you might try adding the geometries to an array and using IHookActions.DoActionOnMultiple as in this sample.

share|improve this answer
Tried your first solution, and it works great. In a matter of fact "Jay Cummins" answer(which he removed) was actually working as well, but I forgot to zoom out to check if its drawing somewhere else(whick is currently happening in this case as well). I'm probably missing some SpatialReference somewhere. About flashing - its done, works like a charm! – Sunder Aug 3 '12 at 7:09
Good to hear. If it's not on the screen obviously it won't flash, but the built-in Identify tool does a nifty crosshairs effect so you can see "something" happen even if it's off-screen. I haven't yet figured out how to replicate that. – blah238 Aug 3 '12 at 21:34

The method I used in one of my add-ins was to put all the features into a GeometryBag and use ITopologicalOperator::ConstructUnion to merge it into a single geometry. I passed this geometry into the FlashGeometry snippet.

Here's how I did it (in VB.NET). In my case, I was using an IQueryFilter to make the selection of features (either polygons or polylines) to flash

    Dim pFCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
    Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature
    Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry
    Dim pGeometryBag As ESRI.ArcGIS.Geometry.IGeometryCollection = New ESRI.ArcGIS.Geometry.GeometryBag
    Dim pPolygon As ESRI.ArcGIS.Geometry.IPolygon
    Dim pPolyline As ESRI.ArcGIS.Geometry.IPolyline
    Dim pQFilter As New ESRI.ArcGIS.Geodatabase.QueryFilter
    Dim pRgbColor As New ESRI.ArcGIS.Display.RgbColor
    Dim pTopoOp As ESRI.ArcGIS.Geometry.ITopologicalOperator4

    Using releaser As New ESRI.ArcGIS.ADF.ComReleaser

       pQFilter.WhereClause = [String].Format("{0} in ({1})", pFClass.OIDFieldName, sender.Rows(e.RowIndex).Cells("colAdjacentOIDs").value)
       pFCursor = pFClass.Search(pQFilter, True)
       pFeature = pFCursor.NextFeature

       Do Until pFeature Is Nothing
           pFeature = pFCursor.NextFeature

       Select Case pFClass.ShapeType
           Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon
                pTopoOp = New ESRI.ArcGIS.Geometry.Polygon
                pPolygon = pTopoOp
                pGeometry = pPolygon
           Case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline
                pTopoOp = New ESRI.ArcGIS.Geometry.Polyline
                pPolyline = pTopoOp
                pGeometry = pPolyline
       End Select

       pRgbColor.Red = 255

       FlashGeometry(pGeometry, pRgbColor, My.ArcMap.Document.ActiveView.ScreenDisplay, 500)
   End Using
share|improve this answer
I were already considering this, and your suggestion seems like a valid solution if you'r dealing with one type of geometries. The drawback is that it can't functionate with different kind of geometries because you cant merge points, polylines and polygons in single geometry... or can it? In worst case I can flash them in order - first points, then polylines, etc. I'll replay my results on this matter tomorrow. – Sunder Aug 2 '12 at 15:07
In the end I sticked with blah238 answer. As it is more viable in my case. – Sunder Aug 3 '12 at 7:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.