public override void OnClick() { IApplication application = m_hookHelper.Hook as IApplication; IMxDocument mxdDoc = application.Document as IMxDocument; IMap map = mxdDoc.ActiveView.FocusMap; IGraphicsContainer graphicsContainer = mxdDoc.PageLayout as IGraphicsContainer; IFrameElement frameElement = graphicsContainer.FindFrame(map); IMapFrame mapFrame = frameElement as IMapFrame; // this line crashes in ArcGIS v10 mapFrame.ExtentType = esriExtentTypeEnum.esriExtentBounds; // this line also crashes in ArcGIS v10 //mapFrame.ExtentType = esriExtentTypeEnum.esriAutoExtentBounds; }
(m_frame.Map as IActiveView).Extent = extent;
(m_frame.Map as IActiveView).Extent = extent; m_frame.MapBounds = extent;