Displaying MapTips in the MapControl


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

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.

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

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Add some feature data to the MapControl.
  2. Select the layer you want to display MapTips for, then select the display field for displaying MapTips. Move the mouse pointer over the MapControl.

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