VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A easy Scroll with 1 line of code

by Steve Williams (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Scroll a label with just one line of code...great for showing credits!!!!

Inputs
You will need a timer and set the interval to 1 and of course a label with whatever you want to say. In this example position the label toward the bottom of the form
Assumes
Put this in your timer event Bottom to Top Scroll 1) Use the move method; label1.Move 2) Keep the labels Left property the same; label1.move label1.left 3) Move it by subtracting from the top label1.Move label1.Left, label1.Top - 10 Thats it...It don't get any easier than this! For a faster scroll just subtract more from the top; ie: label1.Move label1.Left, label1.Top - 50 Side Scroll "Marquee" label1.Move label1.Left - 10 The Top is optional as well as the Width and Height
Side Effects
It will give the same amount of flicker as the others do but why write all that code to do the same purpose?

Rate A easy Scroll with 1 line of code

Private Sub Timer1_Timer()
  Label1.Move Label1.Left, Label1.Top - 10
End Sub

Download this snippet    Add to My Saved Code

A easy Scroll with 1 line of code Comments

No comments have been posted about A easy Scroll with 1 line of code. Why not be the first to post a comment about A easy Scroll with 1 line of code.

Post your comment

Subject:
Message:
0/1000 characters