' Tip:其实很多问题在以前的贴子里都有过很好的解答,我建议大家提问前先搜一下以前的贴子,会节约很多时间的.
'
' Author:吴文智
' Date:2001-11-21
'Description:要试用本例请在窗体中填加
' 然后在代码窗体中粘贴如下代码
' Good luck!Option ExplicitDim tempx As Single
Dim tempy As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
tempx = X
tempy = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'向右和向下的你自己加吧
Dim lngLeft As Long
Dim lngTop As Long If Button = 1 Then
lngLeft = Picture1.Left + X - tempx
If lngLeft < 50 Then
Picture1.Left = 50
Else
Picture1.Left = Picture1.Left + X - tempx
End If
lngTop = Picture1.Top + Y - tempy
If lngTop < 50 Then
Picture1.Top = 50
Else
Picture1.Top = Picture1.Top + Y - tempy
End If
End If
End Sub
'
' Author:吴文智
' Date:2001-11-21
'Description:要试用本例请在窗体中填加
' 然后在代码窗体中粘贴如下代码
' Good luck!Option ExplicitDim tempx As Single
Dim tempy As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
tempx = X
tempy = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'向右和向下的你自己加吧
Dim lngLeft As Long
Dim lngTop As Long If Button = 1 Then
lngLeft = Picture1.Left + X - tempx
If lngLeft < 50 Then
Picture1.Left = 50
Else
Picture1.Left = Picture1.Left + X - tempx
End If
lngTop = Picture1.Top + Y - tempy
If lngTop < 50 Then
Picture1.Top = 50
Else
Picture1.Top = Picture1.Top + Y - tempy
End If
End If
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货