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(); }
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(); activeView.ScreenDisplay.UpdateWindow(); IFeatureIdentifyObj featIdentify = new FeatureIdentifyObject(); featIdentify.Feature = m_feature; IIdentifyObj identify = featIdentify as IIdentifyObj; identify.Flash(activeView.ScreenDisplay); }
Worked for me! Thanks!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.