Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Smoothly scrolling text in a Picture Box

Status
Not open for further replies.

anam711

Programmer
Apr 25, 2006
5
US
In thread222-531427 Strongm gave an example of how to display smoothly scrolling text in a Picture Box. I used the code and found it worked perfectly for small strings. However, for larger strings only approximately the first 400 characters are displayed.

Is there a way to display larger strings, say, 10,000 characters?

I am trying to develop a speed reading program for myself and need to display relatively large text files at various speeds.

Thanks in advance for any help.

Dan
 
Just a small example for understanding :

Create a new form with
3 PictureBox's
-Picture1
Inside Picture1 -PictureText(0)
Inside Picture1 -PictureText(1)
1 CommandButton
-Command1
1 Label
- .Caption = Interval
1 TextBox
-Text1
1 Timer
-Timer1

Put the following code in the form and Click on Command1.

You will see the 2 picture box's continually rotating through the main picture box. If at start up you put text into the PictureText box's and every time one picture leaves the left side put the next line into that one.

Put enough text into each pic so that it is larger then the visible width, then resize the pic :
pa.width = pa.TextWidth(Text String).

If modify Strongm's code and read straight from a file 40,000 shouldn't be a problem.





Option Explicit
Dim pa As PictureBox
Dim pb As PictureBox
Dim pi As Integer

Private Sub Command1_Click()
PictureText(0).Width = Picture1.Width + 100
PictureText(1).Width = PictureText(0).Width
PictureText(0).Left = 0
PictureText(1).Left = PictureText(0).Width
PictureText(0).Top = 0
PictureText(1).Top = 0
PictureText(1).Height = PictureText(0).Height
Picture1.Height = PictureText(0).Height
Set pa = PictureText(0)
Set pb = PictureText(1)
pi = 0
Timer1.Interval = CInt(Text1.Text)
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Text1.Text = 10
PictureText(0).BackColor = vbRed
PictureText(1).BackColor = vbBlue
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
pa.Left = pa.Left - 10
pb.Left = pa.Left + pa.Width
If pa.Left + pa.Width < 0 Then
Select Case pi
Case 0
Set pa = PictureText(1)
Set pb = PictureText(0)
pi = 1
Case 1
Set pa = PictureText(0)
Set pb = PictureText(1)
pi = 0
End Select
End If
Timer1.Enabled = True
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top