|
-
Jan 17th, 2000, 09:41 AM
#1
Thread Starter
Junior Member
I have a program that has an image control which I would like to move with a timer. I want the image to move up and down. So far my code looks like this in the TIMER's code:
imgImage.Top = imgImage.Top - 40
ok, i guess i know how to move the image and all... but the real problem is how do i make it move in a certain range? i want the image to keep going up and down between the TOP values of 1560 and 2880. How can i do this? When the image reaches the top value of 1560, i want the image to automatically start going down to the value of 2880. And when it reaches the value of 2880, I want it to start going back up to the value of 1560, and keep doing this.
Will I need a For Next... Loop? If so, i've never used a for next loop to move something with the timer. Can someone provide the code? Please help me!!!! I need helpp!! Thanks.
-
Jan 17th, 2000, 11:01 AM
#2
Registered User
Idiot, this is the code.
Let me know if this helped you!
Regards
Jefferson
Option Explicit
Const pMIN_VALUE As Long = 1560
Const pMAX_VALUE As Long = 2880
Dim nCurrentTOP As Long
Dim lAction As Boolean
Private Sub Form_Load()
nCurrentTOP = pMIN_VALUE
Image1.Top = pMIN_VALUE
End Sub
Private Sub Timer1_Timer()
If nCurrentTOP >= pMAX_VALUE Then
lAction = True
ElseIf nCurrentTOP <= pMIN_VALUE Then
lAction = False
End If
nCurrentTOP = IIf(lAction, nCurrentTOP - 40, nCurrentTOP + 40)
Image1.Top = nCurrentTOP
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|