Results 1 to 6 of 6

Thread: Moving a Picture box

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    3

    Question

    Could some one please gimme the code to move picture boxes with the directional buttons?
    Thank you kindly,
    ~W~
    :P

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    Try this.

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyUp
            Me.Top = Me.Top - 120
        Case vbKeyDown
            Me.Top = Me.Top + 120
        Case vbKeyLeft
            Me.Left = Me.Left - 120
        Case vbKeyRight
            Me.Left = Me.Left + 120
    End Select
    End Sub
    It moves a form for 120 twips up/down/left/right.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    3

    Humm...

    Thanks for your reply, but I’m not really looking to move the whole form. I'm trying to move just a picture box on the form.
    Again thank you for your reply and any further code would be greatly appreciated.
    ~W~
    :P

  4. #4
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200
    Yes I know.
    I just gave you a general example. To move a PictureBox, simply replace the ME keyword with the name of a PictureBox and set the KeyPreview propery of a form to TRUE, or place the code in PictureBox's KeyDown event.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    3

    Talking Thank you

    I give you much thanks, it works perfectly.
    ~W~
    :P

  6. #6
    Addicted Member
    Join Date
    Aug 2000
    Location
    Croatia
    Posts
    200

    Wink

    You're welcome...

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