当D2010中的鼠标不移动时,OnMouseMove为什么会反复触发? [英] Why does OnMouseMove fire repeatedly when the mouse is not moving in D2010?

查看:140
本文介绍了当D2010中的鼠标不移动时,OnMouseMove为什么会反复触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在移植到D2010的Delphi 5应用程序,我有一个问题。在一个窗体上是一个带有OnMouseMove事件的TImage组件,每当鼠标移动到图像上时,它应该更新一个标签。这在原始应用程序中工作得很好,但是当鼠标在图像上方时,OnMouseMove事件会不断触发,无论是否移动,导致标签闪烁。



有人知道是什么原因造成的,如何解决?

解决方案

我的心灵调试感觉告诉我你在Windows上,标签是一个工具提示窗口,您正在每个mousemove进行更新。



在所有严重性中,我已经看到了这个确切的事情工具提示窗口,当我们切换到Vista。似乎更新版本的Windows工具提示窗口在更新时会产生WM_MOUSEMOVE消息。我唯一可以找到的解决方案是仅在文本实际更改时才更新标签。



所以,如果你不在Windows上,请忽略我。但是如果您使用的是Windows,请尝试仅在实际更改标签文本时更新。


I'm porting a Delphi 5 app to D2010, and I've got a bit of a problem. On one form is a TImage component with an OnMouseMove event that's supposed to update a label whenever the mouse is moved over the image. This worked just fine in the original app, but now the OnMouseMove event fires constantly whenever the mouse is over the image, whether it's moving or not, which causes the label to flicker horribly.

Does anyone know what's causing this and how to fix it?

解决方案

My psychic debugging sense tells me that you are on Windows, the label is a tooltip window and you are updating on every mousemove.

In all seriousness, I've seen this exact thing with tooltip window when we switched to Vista. It seems that more recent versions of the Windows tooltip window somehow generate WM_MOUSEMOVE messages when you update them. The only fix I could find was to only update the label when the text actually changes.

So, If you aren't on windows, Ignore me. But if you are on Windows, try updating the label text only when it actually changes.

这篇关于当D2010中的鼠标不移动时,OnMouseMove为什么会反复触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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