laptop and a wrench

Bug

When programatically switching between Pagelayout > Dataframe > back to Pagelayout, the dataframe shifts only in 9.3.

Last Published: August 25, 2014 ArcGIS for Desktop
Bug ID Number NIM038376
SubmittedSeptember 11, 2008
Last ModifiedJune 5, 2024
Applies toArcGIS for Desktop
Version found9.3
Operating SystemWindows OS
Operating System VersionXP
StatusNon-Reproducible

Additional Information

No Public Explanation

Workaround

Instead of switching the activeview from pagelayout back to the focusmap. Set the focusmap of the activeview (in this case, the pagelayout) directly to that of the dataframe.Public Sub ZoomToSelectedWorkaround() Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pFSel As IFeatureSelection Set pFSel = pMxDoc.FocusMap.Layer(0) Dim pSelset As ISelectionSet Set pSelset = pFSel.SelectionSet ' Build a Geometry from the Selected Features Dim pEnumGeom As IEnumGeometry Dim pEnumGeomBind As IEnumGeometryBind Set pEnumGeom = New EnumFeatureGeometry Set pEnumGeomBind = pEnumGeom pEnumGeomBind.BindGeometrySource Nothing, pSelset Dim pGeomFactory As IGeometryFactory Set pGeomFactory = New GeometryEnvironment Dim pGeom As IGeometry Set pGeom = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeom) pGeom.Project pMxDoc.FocusMap.SpatialReference ' Set the Active View's Extent to the Extent of the Selecected Features If TypeOf pMxDoc.ActiveView Is IPageLayout Then 'ESRI Added Dim pGC As IGraphicsContainer Set pGC = pMxDoc.ActiveView pGC.Reset 'instead of switching back to the data frame view, set the 'focusmap directly in the pagelayout Set pMxDoc.ActiveView.FocusMap = pMxDoc.Maps.Item(0) 'now need to zoom to selected features in focusmap in the pagelayout (activeview) 'instead of actually switching to the dataframe Dim pElement As IElement Set pElement = pGC.Next Do Until pElement Is Nothing If TypeOf pElement Is IMapSurroundFrame Then Dim pMapSurroundFrame As IMapSurroundFrame Set pMapSurroundFrame = pElement If <a href="http://pMapSurroundFrame.MapFrame.Map.Name" target="_blank">pMapSurroundFrame.MapFrame.Map.Name</a> = "Layers" Then Dim pAV As IActiveView Set pAV = pMapSurroundFrame.MapFrame.Map pAV.Extent = pGeom.Envelope End If End If Set pElement = pGC.Next Loop Set pMxDoc.ActiveView = pMxDoc.PageLayout Else pMxDoc.ActiveView.Extent = pGeom.Envelope End If Set pMxDoc.ActiveView = pMxDoc.PageLayout pMxDoc.ActiveView.RefreshEnd Sub

Steps to Reproduce

Bug ID: NIM038376

Software:

  • ArcGIS for Desktop

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options