MouseHover / MouseLeave事件在整个窗口中 [英] MouseHover/MouseLeave event on the whole entire window

查看:110
本文介绍了MouseHover / MouseLeave事件在整个窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Form子类,带有 MouseHover MouseLeave 的处理程序。当指针位于窗口的背景上时,事件工作正常,但是当指针移动到窗口中内的控件时,会导致 MouseLeave event。

I have Form subclass with handlers for MouseHover and MouseLeave. When the pointer is on the background of the window, the events work fine, but when the pointer moves onto a control inside the window, it causes a MouseLeave event.

有没有事件覆盖整个窗口。

Is there anyway to have an event covering the whole window.

(。NET 2.0 ,Visual Studio 2005,Windows XP。)

(.NET 2.0, Visual Studio 2005, Windows XP.)

推荐答案

当鼠标离开事件被触发时,一个选项是检查当前位置的指针,看看它是否在窗体区域内。我不知道是否有更好的选择。

When the mouse leave event is fired one option is to check for the current position of the pointer and see if it within the form area. I am not sure whether a better option is available.

编辑:我们有一个类似的问题,可能是您感兴趣的。 如何检测鼠标是否在C#中的整个窗体和子控件之内?

We have a similar question which might be of interest to you. How to detect if the mouse is inside the whole form and child controls in C#?

这篇关于MouseHover / MouseLeave事件在整个窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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