This topic gives you detailed step-by-step instructions on how to add tooltips in your map. The tooltips are displayed when the mouse is over a region in the map.
1. Create a WinForms project and add the MapView control as described in the "Getting Started" section.
2. Add event handler for the MapElementHover event of your MapView instance.
C#
![]() |
---|
this.mapView.MapElementHover += new System.EventHandler<MindFusion.Mapping.WinForms.MapEventArgs>(this.mapView_MapElementHover); |
VB.NET
![]() |
---|
AddHandler mapView.MapElementHover, AddressOf Me.mapView_MapElementHover |
3. Add a System.Windows.Forms.ToolTip instance somewhere in the code behind file.
C#
![]() |
---|
ToolTip toolTip = new ToolTip(); |
VB.NET
![]() |
---|
Dim toolTip As ToolTip = New ToolTip |
4. Handle the MapElementHover event - get the region under the mouse, construct and display the tooltip.
C#
![]() |
---|
private void mapView_MapElementHover(object sender, MapEventArgs e) if (region != null) //Gets the DBF database row associated with the region //get the client coordinates of the mouse position //initialize the tooltip |
VB.NET
![]() |
---|
Private Sub mapView_MapElementHover(ByVal sender As Object, ByVal e As MapEventArgs) |
5. Compile and run your project. By now you must have working tooltips.