PDA

Click to See Complete Forum and Search --> : move a picture on parts of a form (using VB5)


royan
Dec 19th, 1999, 02:41 AM
I have a form with a large picturebox all over it. on this
picturebox I have a small image that the user move around the
picture clicking with the mouse. now I want to add more
pictureboxes onto the big picturebox. But the image may not move
under/above/through these new pictureboxes. I want the igae to
stop at the pictures or move around them.

Dec 21st, 1999, 04:16 AM
you can do this by using the BitBlt function in the Kernel or User API (I forget which), and using a type or two. Once you have figured out how to have the BitBlt method re-paint the image, check the image types. Here's example code on the types:

Public Type ImageToMove
Left as Long
Width as Long
Top as Long
Height as Long
End Type

Public Type ImageToStay
Left as Long
Width as Long
Top as Long
Height as Long
End Type

now create your vaiables:
Dim MyMovingImage as ImageToMove
Dim MyStationaryImage as ImageToStay

and to compare them:

If MyMovingImage.Left > MyStationaryImage.Width And MyMovingImage.Top > MyStationaryImage.Height Then
'Not on the stationary image
ElseIf MyMovingImage.Left < MyStationaryImage.Left And MyMovingImage.Top < MyStationaryImage.Top Then
'Not on the stationary image (maybe)
Else
'Definately on the stationary image
End If