Results 1 to 3 of 3

Thread: Drag&Drop outside the app doesn't trigger

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2010
    Posts
    21

    Drag&Drop outside the app doesn't trigger

    Hi,

    I'm making a game where you can drag & drop (move around) Image controls on the Form (among other things). In the Image MouseMove event I call the Drag event and disable the Image, and in the Form DragDrop event I position the image and re-enable the Image. But, if a user drags the image outside the form, the "No Drop" cursor appears and if the user actually "drops" the image outside, the form's DragDrop event doesn't trigger, thus the Image isn't re-enabled.
    I'm using (manual) Drag&Drop, not OLEDrag&Drop. Any suggestions as to how to handle dragging outside? Should I use OLEDragDrop?

    Thanks
    Last edited by Meehael; Feb 27th, 2012 at 08:55 AM.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Drag&Drop outside the app doesn't trigger

    When you say manual drag, what exactly do you mean? Can you show us the code you use to perform the drag operation?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2010
    Posts
    21

    Re: Drag&Drop outside the app doesn't trigger

    Quote Originally Posted by LaVolpe View Post
    When you say manual drag, what exactly do you mean? Can you show us the code you use to perform the drag operation?
    DragMode is Manual, that's what I meant. I don't have the project with me at the moment, but a piece of drag & drop code should be something like this:
    Code:
    Private Sub imgClue_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    X1 = X
    Y1 = Y
    End Sub
    
    Private Sub imgClue_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
    imgClue(Index).Drag
    imgClue(Index).Enabled = False
    End If
    End Sub
    
    Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
    Source.Left = X - X1 / 15
    Source.Top = Y - Y1 / 15
    End Sub
    
    Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single, State As Integer)
    Source.Enabled = True
    End Sub
    Picture1 is spread across the whole form and ScaleMode is Pixel

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