Rotate display


Purpose
This sample demonstrates how to set the MapControl Rotation property as well as the MapControl, MouseIcon, and MousePointer properties.
 
The MouseIcon property is set to a custom icon stored in a resource file using the IPictureDispLoadResFile method in the FormLoad event. The MouseIcon is used when the MousePointer property is set to esriPointerCustom. The Browse Dialog option allows you to search and select map documents, which are then validated and loaded onto the MapControl using the CheckMxFile and LoadMxFile methods. The OnBeforeScreenDraw and OnAfterScreenDraw events are used to set the MousePointer while the display is refreshing due to extent changes.
 
The OnMouseDown event uses either the TrackRectangle method to zoom in or the IScreenDisplayRotateStart method to start rotating around the center of the display based on the current mouse pointer location. The OnMouseMove event uses the IScreenDisplay RotateMoveTo and RotateTimer methods to move and redraw the display to the screen. The OnMouseUp event uses the IScreenDisplay RotateStop method to determine the angle of rotation. The MapControl Rotation property is set to this angle, and the display is refreshed to reflect the change.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Run the RotateDisplay application.
  2. Load a map document onto the MapControl.
  3. Use the left mouse button to zoom in and the right mouse button to rotate the display.


Download the files for Java
mapbean/RotateDisplay.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo