只是示意~Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Static sX As Single, sY As Single Dim dX As Single, dY As Single
If Button <> vbLeftButton Then sX = X sY = Y Else With Picture1 dX = .Width + (X - sX) dY = .Height + (Y - sY) .Move .Left, .Top, dX, dY sX = X sY = Y End With End If End Sub
只做了左下角的拖动 矩形框可以用Shape做~Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Static sX As Single, sY As Single Dim dX As Single, dY As Single
If Button <> vbLeftButton Then sX = X sY = Y With Picture1 If X > .ScaleWidth * 0.9 And Y > .ScaleHeight * 0.9 Then .MousePointer = 8 Else .MousePointer = 0 End If End With ElseIf Picture1.MousePointer = 8 Then With Picture1 dX = .Width + (X - sX) dY = .Height + (Y - sY) .Move .Left, .Top, dX, dY sX = X sY = Y End With End If End Sub
Static sX As Single, sY As Single
Dim dX As Single, dY As Single
If Button <> vbLeftButton Then
sX = X
sY = Y
Else
With Picture1
dX = .Width + (X - sX)
dY = .Height + (Y - sY)
.Move .Left, .Top, dX, dY
sX = X
sY = Y
End With
End If
End Sub
矩形框可以用Shape做~Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static sX As Single, sY As Single
Dim dX As Single, dY As Single
If Button <> vbLeftButton Then
sX = X
sY = Y
With Picture1
If X > .ScaleWidth * 0.9 And Y > .ScaleHeight * 0.9 Then
.MousePointer = 8
Else
.MousePointer = 0
End If
End With
ElseIf Picture1.MousePointer = 8 Then
With Picture1
dX = .Width + (X - sX)
dY = .Height + (Y - sY)
.Move .Left, .Top, dX, dY
sX = X
sY = Y
End With
End If
End Sub