Rotate display

This sample demonstrates how to set the MapControl Rotation property and 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 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.

  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.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

mapbean/ Main class.

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced