This document is archived and information here might be outdated.  Recommended version.


IActiveView Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IA > IActiveView Interface
ArcGIS Developer Help

IActiveView Interface

Provides access to members that control the active view - the main application window.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

This interface manages the main application window in ArcMap and all drawing operations.

In ArcMap, two objects implement this interface: PageLayout and Map.  These two objects correspond to the two different views in ArcMap: layout and data view. Only one view can be active at a time and this is termed the active view. IMxDocument::ActiveView holds a reference to the current active view object (a Map or the PageLayout). For example, if the ArcMap application is in layout mode, IMxDocument::ActiveView returns an IActiveView reference to the PageLayout object.  Alternatively, if the application is in data view, this propery returns a reference to the focus map. 

ArcMap has view commands which allow users to toggle between layout view and data view. These commands appear on the View menu and on the scroll bar.

An ArcMap document can contain many Maps. Make sure you have the desired object when working with this interface. Otherwise, operations such as drawing may not be occurring in the application window as you expect. For example, a Map obtained through IMxDocument::Maps is not guaranteed to be the focus map. If you know you want a reference to the focus map, use IMxDocument::FocusMap.  Similarly, if you know you want a reference to the page layout, use IMxDocument::PageLayout instead. You can change the document's active view by setting IMxDocument::ActiveView. Learn more by reading the help for this property. 



 

Members

Name Description
Method Activate Gives this view control of the specified window.
Method Clear Empties the view contents.
Method ContentsChanged Called by clients when view objects are modified.
Method Deactivate Another view takes over the associated window.
Method Draw Draws the view to the specified device context.
Read-only property ExportFrame The device rectangle to export.
Read/write property Extent The visible extent rectangle.
Read-only property ExtentStack The extent stack.
Read/write property FocusMap The map that tools and controls act on.
Read/write property FullExtent The full extent rectangle.
Method GetContextMenu Called when a context menu should be displayed at the given xy location. Return menu that should be displayed.
Read-only property GraphicsContainer The active graphics container.
Method HitTestMap Returns any maps present in the view at the given location. Return value may be zero if there are no maps or the coordinate is not over a map.
Method IsActive Indicates if view is active or not.
Read/write property IsMapActivated Indicates if the focus map is activated.
Method OnMessage Call from your application's message loop to enable automatic resizing and keyboard accelerators.
Method Output Renders the view to the specified DC.
Method PartialRefresh Draws the specified view phase. Use an envelope of zero to draw the entire phase.
Method PrinterChanged Called by application when printer changes.
Method Refresh Causes the entire view to draw.
Read-only property ScreenCacheID The screen cache ID that is used to draw the specified phase.
Read-only property ScreenDisplay The screen display used by the view.
Read/write property Selection The selection.
Read/write property ShowRulers Indicates if rulers are visible.
Read/write property ShowScrollBars Indicates if scrollbars are visible.
Read/write property ShowSelection Indicates if selection is visible.
Read-only property TipText The tip text to display at the given location.

Classes that implement IActiveView

Classes Description
Globe (esriGlobeCore) A container for the display and manipulation of data in the Globe.
Map A container for the display and manipulation of map data.
PageLayout Page Layout class contains maps and map surrounds.
Scene (esri3DAnalyst) A container for the display and manipulation of data.

Remarks

When working with the IActiveView interface on a MapDocument object, you should always first call IActiveView::Activate() in order to properly initialize the display of the PageLayout or Map object. The MxDocument and MapServer objects initialize display objects automatically after opening an MXD, but MapDocument does not do this.   If your application has a user interface, you should call Activate() with the hWnd of the application's client area.  If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.

 

See Also

IMxDocument.ActiveView Property

.NET Samples

Use an AlgorithmicColorRamp to color a ClassBreaksRenderer Layer effects animation in ArcMap Move a graphic along a path in ArcMap Move a graphic along a path in ArcMap Applying a time offset to a time-aware feature layer Configure a command for a specific locale Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map navigation commands Custom map selection commands Custom map selection commands Create a custom tool Custom UI elements using add-ins Custom UI elements using add-ins Layer property page and property sheet Dynamic biking Dynamic display animated zoom Dynamic display animated zoom Dynamic logo Cut polygons without selection edit task Custom reshape polyline edit task Export active view Make a custom time slider Building a MapViewer application using the ArcGIS Engine controls Building a MapViewer application using the ArcGIS Engine controls Copy the PageLayoutControl focus map and overwrite the MapControl map Print active view Print active view with ArcPress Print multiple pages RSS weather layer RSS weather layer RSS weather layer Schematic diagram auto refresh Implementing a schematic digitizing tool Custom selection extension Create a custom selection extension by extending ArcObjects Set flow by digitized direction Set the time extents for a layer then render the layer StreetMap routing Add a custom bookmarks MultiItem to the ToolbarControl Creating a zoom factor extension that works with a ToolbarControl Creating a zoom factor extension that works with a ToolbarControl