Results 1 to 2 of 2

Thread: Move picture (2)

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305

    Post

    English:
    I want that I can move a picture (which is bigger than the screen) by pressing the right
    mouse-button and moving the mouse.

    (VB 3, but normally this doesn't matter. I've also VB6, but for this Program I Use VB3)

    Deutsch:
    Ich möchte, daß ich ein Bild, das größer als der Bildschirm ist, mit der rechten Maustaste
    bewegen kann (wie in "Die Sidler").


    Matthias Lambertz

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

    Post

    Try this:
    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 = vbRightButton 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)
        If Button = vbRightButton Then
            Picture1.Move Picture1.Left + (X - oX), Picture1.Top + (Y - oY)
        End If
    End Sub
    ------------------
    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