Results 1 to 3 of 3

Thread: VISUAL STUID 2017 scrooling image keeps moving

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    VISUAL STUID 2017 scrooling image keeps moving

    long time since ive been here
    im trying to move a picture from down to top and when it reaches the top
    to do the same thing.
    some how it keeps going up.
    any idea what im missing?
    this is the code
    Code:
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            PictureBox1.Top -= 2
        End Sub
    Code:
        Private Sub PictureBox1_LocationChanged(sender As Object, e As EventArgs) Handles PictureBox1.LocationChanged
    
            If PictureBox1.Top >= Me.Height Then
                PictureBox1.Top = 0 - PictureBox1.Height
            End If
    
        End Sub
    tnx
    salsa

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: VISUAL STUID 2017 scrooling image keeps moving

    The code in Timer1_Tick moves it up

    The code in PictureBox1_LocationChanged checks if it has moved down past a certain point (which it wont have, because it is moving up).


    You probably want the code in PictureBox1_LocationChanged to be like this:
    Code:
            If PictureBox1.Top <= 0 - PictureBox1.Height Then
                PictureBox1.Top = Me.ClientHeight
            End If

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: VISUAL STUID 2017 scrooling image keeps moving

    bingo!!!
    thank you the see

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