摘要载入中… 请稍等…
内容载入中… 请稍等…
| ◎→ | 本类最新 |
|
ListBox项的控制 HitTest的妙用 HitTest的妙用 B对低层硬件访问控制 《 VB5中注册控件三法 》 编制自已的电话录音小程序 Keeping track of VB source cod |
|
| ◎→相关资源 | |
| C语言入门视频教程 C#编程WinForm入门视频 Asp.net入门视频教程下载 VC++编程视频教程下载 VB窗体文章 HTML入门教程 VB基础视频教程 VB窗体文章 VB文件文章 VB数据库文章 VB-API文章 VB控制文章 | |
| ◎→ | 热门资源 |
| 程序启动时,如何自动判断 MDB文 查找月份的最后一天 操作过程动态显示 屏蔽TextBox的系统菜单 判断一个程序启动完成(不是结束) 判断一个32位程序是否结束 判断是否在VB5环境下运行 |
|
捕捉 MouseExit 事件
MouseDown、MouseUp、MouseMove。VB 似乎提供了很好的 Mouse 事件。但好象还缺少什么!对!还差 MouseExit(鼠标移出)事件。在 VB 中,我们要捕捉 MouseExit 事件,必须用 API 函数:
Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
然后,我们可以在控件(以 Picture1 为例)的 MouseMove 事件上加上以下代码:
With Picture1 'Change this to the name of the control
If Button = 0 Then
If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
'Mouse pointer is outside button, so let other controls receive
'mouseevents too:
ReleaseCapture
' 放入鼠标离开的代码
Else
' Mouse pointer is over button, so we'll capture it, thus
' we'll receive mouse messages even if the mouse pointer is
' not over the button
SetCapture .hwnd
' 放入鼠标进入的代码
End If
[1]
| 芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们 |