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 LongConst WM_SYSCOMMAND = &H112
Const SC_MOVE = &HF012Private Sub Form1_Load()
picture1.dragmode=1
End SubPrivate 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的位置没有变,还是在原地不动~!请朋友们帮我解决一下,谢谢
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 LongConst WM_SYSCOMMAND = &H112
Const SC_MOVE = &HF012Private Sub Form1_Load()
picture1.dragmode=1
End SubPrivate 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的位置没有变,还是在原地不动~!请朋友们帮我解决一下,谢谢
第二、消息发错了。请换
SendMessage PictureBox1.hWnd, &HA1, 2, 0
第一、不用设置dragmode吗?
第二、&HA1,2,0 是什么意思,能解述一下吗
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2就是在窗体非客户区,产生一次左键按下HitTestCaption的效果,相当于按住了标题栏啦,明白了吧?
你解决的很明白 ,只是不明白他们具体是什么意思,下午结贴