|
|
Title | Make a ticker tape display |
Description | This example shows how to make a ticker tape display in Visual Basic 6. When a timer fires, the program draws text on a PictureBox, shifting it slightly each time so it moves across the screen. |
Keywords | ticker, scrolling text |
Categories | Controls |
|
|
Use a Timer to move the text periodically.
|
|
Private Sub Timer1_Timer()
Const MESSAGE = "Visual Basic Graphics Code Library"
Static done_before As Boolean
Static msg_width As Single
Static X As Single
If Not done_before Then
msg_width = Picture1.TextWidth(MESSAGE)
done_before = True
X = Picture1.ScaleWidth
End If
Picture1.Cls
Picture1.CurrentX = X
Picture1.CurrentY = 0
Picture1.Print MESSAGE
X = X - 30
If X < -msg_width Then X = Picture1.ScaleWidth
End Sub
|
|
|
|
|
|