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


MapControl CoClass (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Controls)  

MapControl CoClass

Esri MapControl

Product Availability

Available with ArcGIS Engine.

Description

The MapControl encapsulates the Map CoClass and provides additional properties, methods and events for: managing the general appearance, display properties and map properties of the control; adding and managing data layers within the control; loading map documents into the control; dropping data onto the control from other applications; and tracking shapes and drawing to the display.

Extended Error Information

Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.

Interfaces

Interfaces Description
IConnectionPointContainer Supports connection points for connectable objects.
IMapControl2 Provides access to members that control the MapControl.
IMapControl3 Provides access to members that control the MapControl.
IMapControl4 Provides access to members that control the MapControl.
IMapControlDefault Provides access to members that control the MapControl.
IMxdContents (esriCarto) Provides access to members to pass data into and out off a MXD map document file. Coclasses that implement this interface can limited the implementation to one property if required.
IPersist Defines the single method GetClassID, which is designed to supply the CLSID of an object that can be stored persistently in the system. IPersist is the base interface for three other interfaces: IPersistStorage, IPersistStream, and IPersistFile.
IPersistStreamInit Supports initialized stream-based persistence, regardless of whatever else the object does.
ISupportErrorInfo Indicates whether a specific interface can return Automation error objects.
ITOCBuddy Provides access to members that control the TOC buddy.
IToolbarBuddy Provides access to members that control the ToolbarControl buddy.

Event Interfaces

Interfaces Description
IMapControlEvents2 (default) Provides access to events that occur with interaction to the MapControl.
ITOCBuddyEvents Provides access to events that notify the TOC of a change.

Remarks

The MapControl uses a ScreenDisplay as the display object for drawing and will therefore react to the same keyboard and mouse actions as the ScreenDisplay object. 

There is no need to declare the MapControl's outbound interface as described below in most development environments, because the interface is automaticlly implemented.

Working with Events

[Visual Basic 6.0]

When working with MapControl's default outbound interface in Visual Basic 6 declare variables as follows:

Private WithEvents pMapControl as MapControl

When implementing ITOCBuddyEvents declare variables as follows:

Private WithEvents pMapControl as MapControl