Results 1 to 7 of 7

Thread: drag & drop

  1. #1

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545

    drag & drop

    I have an image inside one picture box among an array of picture boxes.

    I want to be able to drag this image from one picture box to another and 'drop' the image onto the new location.

    This is what I have so far...
    VB Code:
    1. Private Sub Picture1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
    2.     Source.Move (X - DragX), (Y - DragY)
    3. End Sub
    The event fires at the right time, but the image always remains in the original picture box. It DOES move, but only slightly, and I'm positive we would have to modify the parent property of the image control somehow. When I tried
    VB Code:
    1. Source.Parent = Picture1(Index)
    it generated errors.

    Is there another way to do this?

  2. #2
    Stiletto
    Guest
    VB Code:
    1. Private Sub Picture1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
    2. Picture1.Picture = Picture2.Picture
    3. End Sub

  3. #3

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    I would really like to move the actual image box there rather than just copy pictures since I have information stored in the tag property

  4. #4

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    also Picture1 is a control array.

  5. #5
    Stiletto
    Guest
    You can copy the Tag property too..
    But as for your request, you want to remove the image from the original image control after you drop it?
    VB Code:
    1. Private Sub Picture1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
    2. Set Source.Picture = Nothing
    3. End Sub

  6. #6

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    Ok thanks i figured it out

  7. #7

    Thread Starter
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    How do you make the image visible while it is being dragged?

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