Results 1 to 2 of 2

Thread: move a picture on parts of a form (using VB5)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 1999
    Posts
    2

    Post

    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.

  2. #2
    Guest

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width