Results 1 to 6 of 6

Thread: [RESOLVED] Moving shape

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Resolved [RESOLVED] Moving shape

    i have a circle and i want to move it all over the form by using arrow buttons. can someone teach me please? thank you

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Moving shape

    Would this work for you?
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Me.KeyPreview = True
    End Sub
    
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        Select Case KeyCode
            Case vbKeyUp
                Shape1.Move Shape1.Left, Shape1.Top - 120
            Case vbKeyDown
                Shape1.Move Shape1.Left, Shape1.Top + 120
            Case vbKeyRight
                Shape1.Move Shape1.Left + 120, Shape1.Top
            Case vbKeyLeft
                Shape1.Move Shape1.Left - 120, Shape1.Top
        End Select
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Re: Moving shape

    Quote Originally Posted by RhinoBull
    Would this work for you?
    Thanks thats perfect but can i somehow put it under a timer so its moves smoothly? thx a lot for your help!

  4. #4

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Posts
    99

    Re: Moving shape

    Quote Originally Posted by RhinoBull
    Timer? What for? Try changing 120 to some smaller number (30 or so...).

    guess i didnt need a timer..haha great man thanks a lot works PERFECT!!!

  6. #6

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