ESRI.ArcGIS.Mobile
MouseMove Event
See Also  Example Send Feedback
ESRI.ArcGIS.Mobile Namespace > Map Class : MouseMove Event

Occurs when the mouse pointer is moved over the map control.

Syntax

Visual Basic (Declaration) 
Public Event MouseMove() As EventHandler(Of MapMouseEventArgs)
C# 
public event EventHandler<MapMouseEventArgs> MouseMove()

Example

The example provided here shows how to use OnMouseMove event to provide dynamic tooltips on the map. The sample assumes that in addition to a map control (map1) you have a ToolTip component named toolTip1 placed on your Visual Studio designer workbench, and that your map layer "City Parcels" contains fields Owner_Name and ParcelNbr.
C#Copy Code
if (!mobileService1.IsOpen) 
  return; 
  
// Get the featureLayer providing tooltip content 
FeatureLayer fLayer = map1.MapLayers["City Parcels"].Layer as FeatureLayer; 
  
// Define query filter that uses position of the mouse 
QueryFilter qf = new QueryFilter(new ESRI.ArcGIS.Mobile.Point(e.MapCoordinate), EsriGeometricRelationship.Within); 
  
// Use FeatureDataReader to quickly get first matching record 
FeatureDataReader fdr = fLayer.GetDataReader(qf); 
  
// Set the tooltip on the map control if a feature is found. 
if (fdr.Read()) 
    toolTip1.SetToolTip(map1, fdr["Owner_Name"].ToString() + "\nParcel #: " + fdr["ParcelNbr"].ToString()); 
else 
    toolTip1.RemoveAll(); 
    

Remarks

OnMouseMove can be used to intercept mouse movement to introduce custom behavior related to map control. It is also useful in a lot of other application scenarios. For example, users might want to select features from layer(s) by clicking on the map control to define a selection area. In such case the OnMouseMove and OnMouseUp events (probably OnMouseDoubleclick event as well to signal the end of selection action) could be used to log the coordinates where users click, and draw the selection area in the OnPaint event of the map control.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also