by Todd Wayman (8 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sat 3rd February 2001
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Scrolls Text Up or Down without API calls or custom controls.
'* Generated using VB 3.0 ToolBar
'* Author: Todd Wayman
'* Date: Mar, 02, 2001
'* Version: 1.00
'* Procedure Title: Scrolling Text
' *************************************************************
'* Comments:
'* I have been looking for a simple control that will
'* allow text to scroll on a form. I did not like any of the
'* ones I found so I made this.
'*
'* All you need is:
'*
'* Timer control (Timer1)
'* Label control (Label1)
'* Picture Box (Picture1)
'*
'* Place the Picture Box on your form then paste the Label control
'* on top of the picture box (not the form).
'*
'* Make sure that Picture Box Scale Mode is set to Twip (1).
'* Set The timer interval to 10
'* and addjust the scrolling speed by Speed.
'*
'* What is real cool is with the picture box you can add a graphics back ground.
'* (Set Label BackStyle to Transparent (0).
'* I have designed two procedures Scroll_Up() and Scroll_Down()
'* Their names say it all.
'*
'*Note:
'*The Label Height should be equal to or greater than that of
'* the picture box.
'* End Comment Block *************************************
' Insert the following in the Form_Load Event
Sub Form_Load ()
Timer1.Interval = 10
Label1.Caption = "Test Text testing to see if I can make a scrolling text box using standard controls."
Label1.Alignment = 2
Label1.BackStyle = 0
End Sub
' Scrolls the text down
Sub Scroll_Down (Speed As Integer)
Label1.Top = Label1.Top + Speed
If Label1.Top >= Picture1.Height Then Label1.Top = Picture1.Top - Label1.Height
End Sub
'Scrolls the text up
Sub Scroll_Up (Speed As Integer)
Label1.Top = Label1.Top - Speed
If Label1.Top <= -1 * Label1.Height Then Label1.Top = Picture1.Height
End Sub
'In the timer event insert the following
Sub Timer1_Timer ()
Scroll_Up (50)
'Scroll_Down (50)
End Sub