Displaying MapTips in the MapControl


PurposeThis sample demonstrates displaying MapTips in the MapControl using the IMapControl3.ShowMapTips and IMapControl3.TipStyle properties.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and 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. Add feature data to the MapControl.
  2. Select the layer to display MapTips, then select the display field for displaying MapTips.
  3. Move the mouse pointer over the MapControl.

Additional information

The Browse dialog box allows users to search and select map documents, which are loaded into the MapControl using the LoadMxFile method. The name of each layer within the MapControl is added to a combo box at the same index. When a layer name is selected in the combo box, the ILayerFields and IField interfaces are used to loop through the layer's fields. The name of each field is added to a second combo box. If the field name is the same as the IFeatureLayer.DisplayField, it is highlighted in the combo box. The DisplayField is the field from which ILayer.TipText is obtained and can be changed by selecting a different field name from the combo box.

A check box indicates whether MapTips will be displayed for the selected layer using the ILayer.ShowTips property. If ILayer.ShowTips is true, the MapControl will display the ILayer.TipText value as the mouse pointer moves over the display. The OnMouseDown event of the MapControl uses the TrackRectangle method to zoom in if clicked, and the Pan method if right-clicked.

AssemblyInfo.cs Assembly information.
MapTips.cs Form file.
Download the C# files
AssemblyInfo.vb Assembly information.
MapTips.vb Form file.
Download the VB.NET files

Download the files for all languages

See Also:

MapControl class
IMapControl3 interface




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