I've posted this on the ESRI support forum, but no one has come back with a solution as yet.
Background: I'm maintaining a C++ map display application that makes use of ESRI ArcGIS components (version 9.3.1 SP1). It instantiates a Map object (esriCarto::Map), queries for the IActiveView interface, and calls Activate to pass in the view window client area (and a whole bunch of other properties are also set via various interfaces). It is then used in the middle of a sequence of drawing operations to render the final display image.
Problem: The WM_MOUSEWHEEL event seems to be picked up in the Map object (or a child object?), and is causing odd behaviour. What's supposed to happen in the app is that the view window receives this message, then calls a 'zoom' method to trigger appropriate redrawing. What actually happens is that the message passes through the view window's PreTranslateMessage, then the display area glitches, then view window's OnMouseWheel handler is called to handle the zoom.
By 'glitches', I mean the view window turns white briefly, then the previous image is redisplayed. This did not happen in a previous version of the app that integrated with ArcGIS 9.2, and none of the app's own drawing code is being called while this glitching effect is happening. It also doesn't happen if the window's zoom function is called via an alternative context menu option.
Having read around the reference info for a while, I suspect that the Map's child ScreenDisplay object is responding to the mouse wheel event and doing something we don't want it to do to the view area - I also suspect there's a way of telling it not to, but I can't seem to find it. I do have a workaround, i.e. to hand开发者_运维技巧le the zoom in the view window's PreTranslateMessage, and prevent the message going any further, but that feels like a bit of a hack.
So, can any kind and clever person please point me at a way of telling the Map object to ignore mouse wheel events?
Better late than never...you can disable the mouse wheel on a MapControl by calling IMapControl4::put_AutoMouseWheel(VARIANT_FALSE) on your MapControl object.
精彩评论