HeN_da_MaN
asked on
String scrolling
I'm building an MP3-Player and a CD-Player, now I'm getting the MP3-filename (Songtitle) to scroll on a label.
The problem I would like to solve is: there is a flikkering of the text and the spaces take more time than the actual characters, does anybody know how to get a smooth scroll without these glitches?
This is how I do it:
Private Sub cmdScroll_Click()
lblScroll.Caption = " " & txtInput.Text
tmrScrollNow.Interval = 75
End Sub
Private Sub tmrScrollNow_Timer()
Dim strInputText As String
Dim i As Integer
Dim strFirstletter As String
Dim strTextMinusFirst
Dim bytLengte As Byte
Dim strToScroll As String
On Error Resume Next
strInputText = lblScroll.Caption
bytLengte = Len(strInputText)
strFirstletter = Left(strInputText, 1)
strTextMinusFirst = Right(strInputText, (bytLengte -1))
strToScroll = strTextMinusFirst & strFirstletter
lblScroll.Caption = strToScroll
strInputText = strToScroll
End Sub
The problem I would like to solve is: there is a flikkering of the text and the spaces take more time than the actual characters, does anybody know how to get a smooth scroll without these glitches?
This is how I do it:
Private Sub cmdScroll_Click()
lblScroll.Caption = " " & txtInput.Text
tmrScrollNow.Interval = 75
End Sub
Private Sub tmrScrollNow_Timer()
Dim strInputText As String
Dim i As Integer
Dim strFirstletter As String
Dim strTextMinusFirst
Dim bytLengte As Byte
Dim strToScroll As String
On Error Resume Next
strInputText = lblScroll.Caption
bytLengte = Len(strInputText)
strFirstletter = Left(strInputText, 1)
strTextMinusFirst = Right(strInputText, (bytLengte -1))
strToScroll = strTextMinusFirst & strFirstletter
lblScroll.Caption = strToScroll
strInputText = strToScroll
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry C_J
I did not updated
U R too fast
I did not updated
U R too fast
what about doing it like this
Public Str As String
Private Sub Form_Load()
Caption = ""
Timer1.Interval = 200
Str = "Hello, World! "
End Sub
Private Sub Timer1_Timer()
Static x As Integer
If x < Len(Str) Then
x = x + 1
Caption = Caption & Mid(Str, x, 1)
Else
x = 0
Caption = ""
End If
End Sub
cheers
hope this helps
andy
Public Str As String
Private Sub Form_Load()
Caption = ""
Timer1.Interval = 200
Str = "Hello, World! "
End Sub
Private Sub Timer1_Timer()
Static x As Integer
If x < Len(Str) Then
x = x + 1
Caption = Caption & Mid(Str, x, 1)
Else
x = 0
Caption = ""
End If
End Sub
cheers
hope this helps
andy
HeN_da_MaN
I use your code and it works just fine for me. No blinking and spaces take the same amount of time as all other numbers & letters.
I use your code and it works just fine for me. No blinking and spaces take the same amount of time as all other numbers & letters.
ASKER
Thank you,
Hen
Hen
How about putting a label on a picture box
then moving it
like that
Hi HeN_da_MaN
Private Sub Command1_Click()
lblScroll.Caption = " " & txtInput.Text
tmrScrollNow.Interval = 5
End Sub
Private Sub tmrScrollNow_Timer()
Dim strInputText As String
Dim i As Integer
Dim strFirstletter As String
Dim strTextMinusFirst
Dim bytLengte As Byte
Dim strToScroll As String
On Error Resume Next
lblScroll.Left = lblScroll.Left - 2
If lblScroll.Left = -lblScroll.Width Then lblScroll.Left = 0
End Sub
yours