Results 1 to 4 of 4

Thread: bitmap dragging

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 1999
    Posts
    99

    Post

    how can i drag a blit'd bitmap around a form?

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Move the PictureboxControl you BitBlt'd the Image onto, eg.
    Code:
    Private oX As Single
    Private oY As Single
    
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            oX = X
            oY = Y
        End If
    End Sub
    
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Static lX As Single
        Static lY As Single
        If Button = vbLeftButton And (lX <> Y Or lY <> Y) Then
            Picture1.Move Picture1.Left + X - oX, Picture1.Top + Y - oY
            lX = X
            lY = Y
        End If
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 1999
    Posts
    99

    Post

    let me make my question more specific...
    the picture is blit'd on the form.

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    I would suggest adding a Picturebox to the Form and BitBlt'ing the Image into the Picturebox, so you can use the Code I posted.
    Otherwise you'll have to check the Coords of the Mouse to see if it's in the Area of the Image, then Clear and Redraw the Image in its New Location as the User Drags the Mouse.
    Most Likely resulting in a bad Flickering effect.


    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

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