Show MapTips

This sample demonstrates how to display MapTips in the MapControl by setting the ToolTipText property to the value of ILayer.TipText in the OnMouseMove event.
The browse dialog box allows you to search and select map documents, which are then loaded into the MapControl using the LoadMxFile method. The name of each layer in 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 IFeatureLayer.DisplayField, it is selected in the combo box. 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 are displayed for the selected layer using the ILayer.ShowTips property. If ILayer.ShowTips is true, the MapControl ToolTipText property is set to the ILayer.TipText value in the OnMouseMove event. The OnMouseDown event of the MapControl uses the TrackRectangle method to zoom in if the left mouse button is pressed, and the Pan method if the right mouse button is pressed.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Run the ShowMapTips application.
  2. Add feature data to the MapControl.
  3. Select the layer to display MapTips.
  4. Select the display field to show the MapTips.
  5. Move the mouse pointer over the MapControl.

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