Map Tips

Created:4/4/2002
Description:

This sample demonstrates displaying map tips in the MapControl by setting the ToolTipText property to the value of ILayer::TipText in the OnMouseMove event.

A GxDialog with a feature class GxObjectFilter enables users to browse and select feature class objects. For each GxObject selected, a FeatureLayer is created and added to the MapControl at a specified index using the AddLayer method. The layers Name is added to a ComboBox at the same index. When a layers Name is selected in the ComboBox the ILayerFields and IField interfaces are used to loop through the layers fields. The Name of each field is added to a second ComboBox. If the field Name is the same as the IFeatureLayer::DisplayField it is selected in the ComboBox. The DisplayField is the field from which ILayer::TipText is obtained and can be changed by selecting a different field Name from the ComboBox.

A CheckBox indicates whether map tips will be displayed for the selected layer using the ILayer::ShowTips property. If ILayer::ShowTips is true, the MapControl's ToolTipText property is set to the ILayer::TipText value within the OnMouseMove event. The OnMouseDown event of the MapControl uses the TrackRectangle method to zoom in if the left mouse button is used, and the Pan method if the right mouse button is used.


How to use:
  1. Either run the MapTips.exe or open the MapTips.vbp and run from within the project.
  2. Add some feature data to the MapControl.
  3. Firtsly select the layer you wish to display map tips for. Secondly, select the display field for displaying map tips. Move the mouse pointer over the MapControl.

Application:
MapControl

Minimum ArcGIS Version Required: 8.2

Difficulty: Beginner


Visual Basic
File Description
MapTips.frm VB form file for the MapTips project.
MapTips.frx VB Binary file.
MapTips.vbp VB Project file.


Key CoClasses: MapControl
Key Interfaces: IFeatureLayer, IField, ILayer, ILayerFields
Key Members: AddLayer, Extent, FullExtent, Layer, ToolTipText, TrackRectangle, Pan