SetCapture 和 ReleaseCapture分别是什么意思啊?怎么用啊?

ncowboy 2004-11-13 12:56:12

Option Explicit

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Font = "隶书"
Command1.Font.Bold = True
Command1.Font.Italic = True
Command1.Font.Size = "50"
SetCapture Me.hwnd
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Font = "宋体"
Command1.Font.Bold = False
Command1.Font.Italic = False
Command1.Font.Size = "20"
ReleaseCapture
End Sub

...全文
98 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwqna 2004-11-13
  • 打赏
  • 举报
回复
SetCapture me.hwnd 既使鼠标移出了窗体,系统也把鼠标产生的消息发回给Me
行云边 2004-11-13
  • 打赏
  • 举报
回复
SetCapture 虏获鼠标事件
ReleaseCapture 释放


SetCapture Me.hwnd '把所有的鼠标消息都传递给Me ,所以你在别的控件或窗口触发的MouseMove也会发送到Me里, 也就是说 会触发Form_MouseMove事件
leolan 2004-11-13
  • 打赏
  • 举报
回复
The SetCapture function sets the mouse capture to the specified window belonging to the current thread. Once a window has captured the mouse, all mouse input is directed to that window, regardless of whether the cursor is within the borders of that window. Only one window at a time can capture the mouse.

If the mouse cursor is over a window created by another thread, the system will direct mouse input to the specified window only if a mouse button is down.


The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing. A window that has captured the mouse receives all mouse input, regardless of the position of the cursor, except when a mouse button is clicked while the cursor hot spot is in the window of another thread.

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧