This project is read-only.

Capturing Scroll event

Jan 26, 2011 at 6:01 PM

I tried capturing the Scroll event on the map control, but the event never fires when I rotate the mousewheel over the map. It seems the most natural way for zooming is using the scroll wheel and I wanted to implement this feature.

Jan 26, 2011 at 6:32 PM
Edited Jan 26, 2011 at 6:32 PM

We are currently using the MapFunction for grabbing the scroll event.  That means that we have a handler in the map control itself, and it successfully forwards the event to the MapFunction, so it is possible that in that bit of code we fail to call base.OnMouseWheel or whatever.  The base "On" method has to be called in order for the control's event to be firing correctly.  Another possibility is that something already is responding to the mouse wheel event and is setting the "handled" flag to true, which may cancel further messages from the event.

I'm not sure that the "Scroll" event is exactly what you want though, are you sure its not MouseWheel or some other thing like that?  Doesn't scroll have to do with responding to when the AutoScroll scrollbars are active?  I'm not sure that they are related to the MouseWheel.  Anyway, between those two points, maybe something will prove useful.

Finally, we already do zoom when you scroll the mouse wheel.  Just set the Map.FunctionMode to one of the settings that supports it like "Pan", and it will activate a function (I think it is FunctionZoom), which is activated simultaneously with the FunctionPan when you set the map function using the Map.FunctionMode enumeration.