本文介绍了鼠标移动捕获(鼠标离开和鼠标进入)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我的应用程序中有三个控件(CButtton),每当鼠标移到一个控件上时,我都想捕获鼠标何时进入窗口中的哪个控件以及何时离开,而我必须更改按钮控件的标题

Hi i have three controls (CButtton) in my application,whenever mouse move over a control,i want to capture when mouse enters on which control in a window and when it leaves and i have to change the caption of a button control.

预先感谢

推荐答案

没有Windows消息/事件指示鼠标进入"或鼠标离开".但是,可以通过为控件处理"MouseMove"消息并捕获鼠标输入以检查该点是否在控件区域内来实现此目的.如果该点不在控制区域内,则释放捕获.

There is no windows message/event that indicates 'mouse enter' or 'mouse leave'.However this can be achieved by handling the 'MouseMove' message for your control and capturing the mouse input to check if the point is inside the control area. Release the capture if the point is out of the control area.

有关示例代码,请在此处.

这篇关于鼠标移动捕获(鼠标离开和鼠标进入)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 11:19