我用sendmessage移动picturebox控件,错在哪里,为何不能移动?
option explicit
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
Const WM_SYSCOMMAND = &H112
Const SC_MOVE = &HF012
Private Sub Form1_Load()
picture1.dragmode=1
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
'为当前的应用程序释放鼠标捕获
ReleaseCapture
'移动控件
SendMessage picturebox1.hwnd, WM_SYSCOMMAND, SC_MOVE, 0
End If
End Sub
在移动时picturebox的位置没有变,还是在原地不动~!请朋友们帮我解决一下,谢谢