PanZoom Commands

Created:1/10/2002
Description:

This sample provides a set of sample PanZoom commands and tools that can either be used in conjunction with the MapControl and PageLayoutControl, or can be used to customize ArcMap.

The sample assumes previous experience in creating custom Tools and Commands.

FixedZoomIn/ Out commands
The IEnvelope::Expand method is used to scale the size of the IActiveView::Extent in order to zoom in/out on the FocusMap by a fixed amount.
ZoomIn/ Out tools
An INewEnvelopeFeedback object is used to track an IEnvelope in the OnMouseDown, OnMouseMove and OnMouseUp events which is then set to the IActiveView::Extent property of the FocusMap. If the ESC key is pressed the track is cancelled.
FullExtent command
The IActiveView::Extent property is set to the FullExtent of all the data layers present in the FocusMap.
GoBackToPrevious/ Next Extent commands
The IActiveView::Extent property is set to the previous/next extent held in the IActiveView::ExtentStack of the FocusMap.
Pan tool
The IScreenDisplay::PanStart/PanMoveTo methods are used within the OnMouseDown and OnMouseMove events to start and move a pan, and the IScreenDisplay::PanStop method is used within the OnMouseUp event to set the IActiveView::Extent property of the FocusMap to the new visible bounds.
PanDown/ Left/ Up/ Right commands
The IActiveView::Extent property of the FocusMap is centered on a Point to the left/right/top/bottom of the current extent's center.


How to use:
  1. Register the PanZoom.dll
  2. Either add the Commands to the ArcMap interface with the Customize dialog.
  3. Or to use the Commands with the MapControl or PageLayoutControl add a reference to the 'ESRI Sample PanZoom Commands' and use the following code.
    Dim pCommand As ICommand
    Set pCommand = New ESRI_PanZoom.ZoomIn
    pCommand.OnCreate PageLayoutControl1.Object
    PageLayoutControl1.CurrentTool = pCommand
    

Application:
ArcMap, MapControl, PageLayoutControl

Minimum ArcGIS Version Required: 8.2

Difficulty: Advanced


Visual Basic Visual C++
File Description
PanZoom.dll Application extentsion.
clsHook.cls VB Class Module to determine the application.
PanZoom.res Resource file containing custom bitmaps and cursors.
clsFullExtent.cls VB Class Module for the FullExtent sample command.
clsGoBackToPreviousExtent.cls VB Class Module for the GoBackToPreviousExtent sample command.
clsGoToNextExtent.cls VB Class Module for the GoToNextExtent sample command.
clsPan.cls VB Class Module for the Pan tool sample command.
clsPanDown.cls VB Class Module for the PanDown sample command.
clsPanLeft.cls VB Class Module for the PanLeft sample command.
clsPanRight.cls VB Class Module for the PanRight sample command.
clsPanUp.cls VB Class Module for the PanUp sample command.
clsZoomIn.cls VB Class Module for the ZoomIn tool sample command.
clsZoomOut.cls VB Class Module for the ZoomOut tool sample command.
clsFixedZoomIn.cls VB Class Module for the FixedZoomIn sample command.
clsFixedZoomOut.cls VB Class Module for the FixedZoomOut sample command.
ErrorHandling.bas VB Module for error handling.
PanZoom.vbp VB Project file.