ArcGIS Developer Help  (Carto)    


Public Sub ZoomInCenter()
  Dim pMxDocument As IMxDocument
  Dim pActiveView As IActiveView
  Dim pDisplayTransform As IDisplayTransformation
  Dim pEnvelope As IEnvelope
  Dim pCenterPoint As IPoint

  Set pMxDocument = Application.Document
  Set pActiveView = pMxDocument.FocusMap
  Set pDisplayTransform = pActiveView.ScreenDisplay.DisplayTransformation
  Set pEnvelope = pDisplayTransform.VisibleBounds
  'In this case, we could have set pEnvelope to IActiveView::Extent
  'Set pEnvelope = pActiveView.Extent
  Set pCenterPoint = New Point
  pCenterPoint.x = ((pEnvelope.XMax - pEnvelope.XMin) / 2) + pEnvelope.XMin
  pCenterPoint.y = ((pEnvelope.YMax - pEnvelope.YMin) / 2) + pEnvelope.YMin
  pEnvelope.width = pEnvelope.width / 2
  pEnvelope.height = pEnvelope.height / 2
  pEnvelope.CenterAt pCenterPoint
  pDisplayTransform.VisibleBounds = pEnvelope
End Sub

[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.