vb picturebox 图形拖动
如图想要实现将picture1中力F拖动到picture2中的梁上两个图形都是用picture属性加载的请高手们赐教...最好能帮我把程序写出来啊谢谢啦...
如图 想要实现将picture1中力F拖动到picture2 中的梁上 两个图形都是用picture属性加载的 请高手们赐教...最好能帮我把程序写出来啊 谢谢啦
展开
展开全部
用下面的代码可以把Picture1拖到任意位置:
Dim xx As Single, yy As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xx = X: yy = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Picture1.Move Picture1.Left + X - xx, Picture1.Top + Y - yy
End Sub
Dim xx As Single, yy As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
xx = X: yy = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Picture1.Move Picture1.Left + X - xx, Picture1.Top + Y - yy
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询