如何实现FORM1在激活的情况下用鼠标拖动FORM1上的picture1box?
如何实现FORM1在激活的情况下用鼠标拖动FORM1上的picture1Box?具体见附件
New Folder.rar
(82.87 KB)
[ 本帖最后由 yuk_yu 于 2010-1-7 14:06 编辑 ]
Private mptx As Single Private mpty As Single Private mbDown As Boolean Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) mptx = X: mpty = Y mbDown = True End Sub Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If mbDown Then Debug.Print mptx, X, mpty, Y Label1.Left = Label1.Left + X - mptx Label1.Top = Label1.Top + Y - mpty End If End Sub Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) mbDown = False End Sub
Private mptx As Single Private mpty As Single Private mbDown As Boolean Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) mptx = X: mpty = Y mbDown = True End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If mbDown Then Debug.Print mptx, X, mpty, Y Picture1.Left = Picture1.Left + X - mptx Picture1.Top = Picture1.Top + Y - mpty End If End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) mbDown = False End Sub