Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ncl As Long
Dim rel As Long
If Button = 1 Then
Dim i As Integer
i = ReleaseCapture()
ncl = SendMessage(Text1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub
楼上的代码适用于任何运行时可见的控件吗