-
Aug 18th, 2005, 04:49 AM
#1
Thread Starter
Member
Scrolling text effect
How can i get the text in a text box to give the illusion it is scrolling?
If i cant do it in a text box can i just get it to scroll across the form then
thnx in advanced
-
Aug 18th, 2005, 04:55 AM
#2
Re: Scrolling text effect
This scrolls in a label, but would be easy to adapt to a textbox.
VB Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Dim titlebar%
Dim title$
Dim z As Long
Dim x%
Dim ichange
Dim stitle$
Dim istart%, iend%
Dim endflag As Boolean
Private Sub Command1_Click()
If endflag = True Then
endflag = False
Else
endflag = True
End If
If endflag = False Then
istart = 1
For x = 1 To titlebar
DoEvents
Label1.Caption = Mid(title, 1, x)
Sleep 200
Next x
Do While endflag = False
If istart + titlebar < Len(title) + 1 Then
stitle = Mid(title, istart, titlebar)
Else
ichange = Len(title) - istart
stitle = Mid(title, istart, ichange) & Mid(title, 1, titlebar - ichange)
End If
Label1.Caption = stitle
DoEvents
If istart < Len(title) Then istart = istart + 1 Else istart = 1
Sleep 200
Loop
End If
End Sub
Private Sub Form_Load()
endflag = True
title = "This is a test. This is only a test..." ' Bar is 10 characters
titlebar = 27
Label1.Caption = ""
End Sub
-
Aug 18th, 2005, 05:03 AM
#3
Hyperactive Member
Re: Scrolling text effect
this would work as well:
create your text to split precced by the textboxes lengh of spaces so that it scrolls
set up a timer and in its code using the Mid function split your text at the first character every time the timer runs.
to make it run multiple times you may need to set up a If statment to see when its lengh is = 0 and then start over
that is what dglienna has done but much more simplified
if you want it to scroll across the form instead then just do what i have explained above but change it to a label possibly the width of the form
-
Aug 18th, 2005, 05:26 AM
#4
Frenzied Member
Re: Scrolling text effect
Another way would be put a label on a container (Pbox, etc) and move that around. Might be a lot faster if there is a lot of text.
-
Aug 18th, 2005, 06:10 AM
#5
Hyperactive Member
Re: Scrolling text effect
you could do it without a pbox couldnt you just move a label accross the screen
-
Aug 18th, 2005, 06:26 AM
#6
Frenzied Member
Re: Scrolling text effect
Without a Pbox container it might flicker a bit.. do note the 'Might'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|