ESRI Map 对象 - 是否可以禁用 MouseWheel 事件处理程序?

发布于 2024-09-02 19:36:50 字数 797 浏览 6 评论 0原文

我已将其发布到 ESRI 支持论坛上,但尚未有人提供解决方案。

背景:我正在维护一个使用 ESRI ArcGIS 组件(版本 9.3.1 SP1)的 C++ 地图显示应用程序。它实例化一个Map对象(esriCarto::Map),查询IActiveView接口,并调用Activate传入视图窗口客户区(并且还通过各种接口设置一大堆其他属性)。然后在一系列绘图操作的中间使用它来渲染最终的显示图像。

问题: WM_MOUSEWHEEL 事件似乎是在 Map 对象(或子对象?)中拾取的,并且导致奇怪的行为。应用程序中应该发生的情况是视图窗口收到此消息,然后调用“缩放”方法来触发适当的重绘。实际发生的情况是,消息通过视图窗口的 PreTranslateMessage,然后显示区域出现故障,然后调用视图窗口的 OnMouseWheel 处理程序来处理缩放。

我所说的“故障”是指视图窗口短暂变白,然后重新显示前一个图像。在与 ArcGIS 9.2 集成的应用程序的早期版本中不会发生这种情况,并且在发生这种故障效果时,不会调用应用程序自己的绘图代码。如果通过替代上下文菜单选项调用窗口的缩放功能,也不会发生这种情况。

阅读了一段时间的参考信息后,我怀疑地图的子 ScreenDisplay 对象正在响应鼠标滚轮事件并对视图区域执行我们不希望它执行的操作 - 我还怀疑有一种方法可以告诉它不是,但我似乎找不到它。我确实有一个解决方法,即处理视图窗口的 PreTranslateMessage 中的缩放,并防止消息进一步传播,但这感觉有点像黑客。

那么,任何善良和聪明的人可以告诉我一种告诉 Map 对象忽略鼠标滚轮事件的方法吗?

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 handle 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤凫 2024-09-09 19:36:50

迟到总比不到好...您可以通过调用 IMapControl4::put_AutoMouseWheel(VARIANT_FALSE)

Better late than never...you can disable the mouse wheel on a MapControl by calling IMapControl4::put_AutoMouseWheel(VARIANT_FALSE) on your MapControl object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文