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!
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.