VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Smooth scrolling marquee text (without API)

Russ Suter  (2 Submissions)   Miscellaneous   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

With this code you can scroll text smoothly in any direction without needing any API calls. All you need is a PictureBox control, a Label control, and a timer.
The code is fully commented and has examples for scrolling in the four main directions.

Assumes
Create a new project. On the main form create a PictureBox control named "pbScrollBox", a Label control named "lblText", and a Timer named "tmrScroll". Make sure the PictureBox control's AutoRedraw property is set to True (to prevent flicker), and the ScaleMode property is set to Pixels. The PictureBox control's ForeColor property determines the color of the text. Make sure the Label control's AutoSize property is set to True. Also make sure the Label control is contained within the PictureBox control. Make sure the PictureBox control and Label control's Font property are set identically. The code gets its geometry information from the label size. If the Font properties don't match and/or the AutoSize property is not set, the text might not wrap properly.

Side Effects
If you have other timers running concurrently, you might get an occasional stutter while the other timer processes its code.

Rate Smooth scrolling marquee text (without API) (40(40 Vote))
Smooth scrolling marquee text (without API).bas

Smooth scrolling marquee text (without API) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters