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
Hi!

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);
            pPoint.Project(activeView.Extent.SpatialReference);

            IEnvelope pCurrentEnvelope = activeView.Extent;
            pCurrentEnvelope.CenterAt(pPoint);

            activeView.Extent = pCurrentEnvelope;
            activeView.Refresh();
        }


After panning  I'm calling FlashGeometry (taken from here: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004900000075000000).

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:

Regards,
Christian

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

Attachments

Outcomes