A easy Scroll with 1 line of code

By | 2002-04-19

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

Original Author: Steve Williams

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

Assumptions

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?

Code

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

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.