在 Delphi VCL 表单中实现鼠标滚轮活动的最佳方法是什么?

发布于 2024-08-26 09:52:34 字数 240 浏览 3 评论 0原文

作为 Delphi 7 的长期用户,我在一些控件中滚动了自己的鼠标滚轮处理,但最近我注意到一些最近的应用程序只需要将鼠标光标放置在控件上(例如列表框或树) view) 的鼠标滚轮活动导致该控件滚动。
这感觉很好(而不是在响应滚轮之前必须单击焦点控件)。

现在我已经转移到 Delphi 2010 我想知道什么是“正确”行为?
我可以在 Delphi 中使用什么来避免我现在不得不用自己的解决方案来解决这个问题?

谢谢。

As a long time user of Delphi 7, I've rolled my own mouse wheel handling in a few controls but lately I've noticed that some recent applications only need the mouse cursor to be placed over a control (e.g. a list box or tree view) for the mouse wheel activity to cause that control to scroll.
This feels nice (as opposed to having to click focus a control before it responds to the wheel).

Now I've moved to Delphi 2010 I'm wondering what is the 'correct' behavior?
And what can I use in Delphi that avoids me having to bodge this with my own solutions now?

Thanks.

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

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

发布评论

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

评论(1

抚你发端 2024-09-02 09:52:34

我不知道是否有官方的“正确”行为,但我个人认为,当鼠标滚轮转到鼠标指针当前悬停的窗口而无需显式为其提供焦点时,它是最直观正确的。然而,这不是默认行为,而且我通常使用的应用程序中大约有一半以一种方式执行此操作,另一半则以另一种方式执行此操作。

要在没有焦点的情况下获取鼠标滚轮消息,您需要实现鼠标钩子。

I don't know if there's an official 'correct' behavior, but I personally find it most intuitively correct when the mouse wheel goes to the window that the mouse pointer is currently hovering over without having to explicitly give it focus. That's not the default behavior, however, and it seems that about half the applications I normally use do it one way and the other half the other way.

To get mouse wheel messages without having focus, you need to implement a mouse hook.

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