vb编程中想点击鼠标左键拖动控件text1在form1窗体上移动 编码怎么写呀,求高手指点。
2个回答
展开全部
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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询