在Delphi VCL表单中实现鼠标滚轮活动的最佳方法是什么? [英] What is the best method for implementing mouse wheel activity in Delphi VCL forms?

查看:136
本文介绍了在Delphi VCL表单中实现鼠标滚轮活动的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Delphi 7的长期用户,我在几个控件中滚动了自己的鼠标滚轮处理功能,但最近我注意到一些最近的应用程序只需要将鼠标光标放在控件上即可(例如,列表框或树状视图),以使鼠标滚轮活动引起该控件滚动.
这感觉很好(与在控件响应方向盘之前必须单击焦点时相反).

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).

现在我已移至Delphi 2010,我想知道什么是正确"行为?
在Delphi中我可以使用什么来避免我现在不得不将其与自己的解决方案结合起来?

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?

谢谢.

推荐答案

我不知道是否存在正式的正确"行为,但是我个人认为,当鼠标滚轮进入鼠标所在的窗口时,这是最直观的正确方法指针当前正在悬停,而无需显式为其赋予焦点.但是,这不是默认行为,似乎我通常使用的大约一半应用程序以一种方式进行操作,而另一半则以另一种方式进行操作.

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.

这篇关于在Delphi VCL表单中实现鼠标滚轮活动的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆