Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

Moving All Four Picturesboxes

$
0
0
I'm using the below code to move a Picturebox around the Form area. It's fine for moving one Picturebox but how do I move all 4 pictureboxes at same time and keep their respective positions by just mouse down on one of the four?


Code:

Dim nX As Single
Dim nY As Single

Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
 nX = X / Screen.TwipsPerPixelX
 nY = Y / Screen.TwipsPerPixelY
End Sub

Private Sub Picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
 If Button = 1 Then
  Picture1(Index).Move Picture1(Index).Left + ((X / Screen.TwipsPerPixelX)) - nX, Picture1(Index).Top + ((Y / Screen.TwipsPerPixelY)) - nY
 End If
End Sub


Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>