这个先要找到 工作表 的窗口句柄 hWnd, 然后还要用到两个API: Private Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long Private Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long
'向无标题椭圆形窗体发送消息WM_NCLBUTTONDOWN,欺骗windows,以为是鼠标位于标题栏内,即可拖动。 '下面是椭圆形窗体的MouseDown事件代码: Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Dim r As Long Dim i As Long 'On Error Resume Next If Button = 1 Then i = ReleaseCapture() If i > 0 Then r = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION,ByVal 0&) End If End If End Sub
然后还要用到两个API:
Private Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long
'下面是椭圆形窗体的MouseDown事件代码:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim r As Long
Dim i As Long
'On Error Resume Next
If Button = 1 Then
i = ReleaseCapture()
If i > 0 Then
r = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION,ByVal 0&)
End If
End If
End Sub
这是问题一:
百思不得其解----在用户窗体中实现鼠标自定义动画图标的问题