AnsweredAssumed Answered

Programatically PanTo / ZoomTo and then Flash features

Question asked by christianjunk on Feb 14, 2011
Latest reply on Jun 23, 2015 by oopsliu

I am trying to programatically pan to a feature and then flash the feature's geometry. For the "Pan To"-function I'm using the following code:

private IFeature m_feature;

public override void OnClick()
            if (m_feature == null) return;

            IMxDocument pMxDoc = m_application.Document as IMxDocument;
            IActiveView activeView = pMxDoc.ActiveView;

            double midX = (m_feature.Extent.XMax + m_feature.Extent.XMin) / 2;
            double midY = (m_feature.Extent.YMax + m_feature.Extent.YMin) / 2;
            IPoint pPoint = new PointClass();
            pPoint.SpatialReference = m_feature.Extent.SpatialReference;
            pPoint.PutCoords(midX, midY);

            IEnvelope pCurrentEnvelope = activeView.Extent;

            activeView.Extent = pCurrentEnvelope;

After panning  I'm calling FlashGeometry (taken from here:

When executing the code in ArcMap the Flash is always done before the Pan and i don't know why:

A moment before the Pan is visible on screen the feature is flashed in the correct position, but the panning seems not to be finished although I'm calling the methods in the right order.

Please help me :confused:


P.S.: I'm using ArcGIS Desktop 9.3.1. I'm not using ArcGIS Engine.