Is there a Pan event somewhat like the Map.TrackOverlay.TrackEnded event to let you know that the map has been Panned by the user?
Dave
Is there a Pan event somewhat like the Map.TrackOverlay.TrackEnded event to let you know that the map has been Panned by the user?
Dave
David,
You can hookup the MapMouseUp event and check the ExtentChangedType if it is Pan or not, please refer the code below:
winformsMap1.ExtentOverlay.MapMouseUp += new EventHandler<MapMouseUpInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseUp);
void ExtentOverlay_MapMouseUp(object sender, MapMouseUpInteractiveOverlayEventArgs e)
{
if (winformsMap1.ExtentOverlay.ExtentChangedType == ExtentChangedType.Pan)
{
// write your code here
}
}
Thanks,
James
Perfect! Thanks!
Dave
Thank you, James.
David,
To expand on that idea of capturing a user action on the map, you can see that you can detect any user action on the extent of the map such as pan of course, but also DoubleClickZoomIn, DoubleClickZoomOut, MouseWheelZoomIn, MouseWheelZoomOut, TrackZoomIn and TrackZoomOut. You just have to know what mouse event to hook up according to the type of user action. For example, the code below detects when the user zooms in or out with mouse wheel.
winformsMap1.ExtentOverlay.MapMouseWheel += new EventHandler<MapMouseWheelInteractiveOverlayEventArgs>(ExtentOverlay_MapMouseWheel);
void ExtentOverlay_MapMouseWheel(object sender, MapMouseWheelInteractiveOverlayEventArgs e)
{
if (winformsMap1.ExtentOverlay.ExtentChangedType == ExtentChangedType.MouseWheelZoomIn)
{
//Write your code here for when the user zooms in with mouse wheel.
}
else if (winformsMap1.ExtentOverlay.ExtentChangedType == ExtentChangedType.MouseWheelZoomOut)
{
//Write your code here for when the user zooms out with mouse wheel.
}
}