Results 1 to 6 of 6

Thread: Scrolling text effect

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    New South Wales, Australia
    Posts
    55

    Arrow 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

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Scrolling text effect

    This scrolls in a label, but would be easy to adapt to a textbox.

    VB Code:
    1. Option Explicit
    2.   Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    3.   Dim titlebar%
    4.   Dim title$
    5.   Dim z As Long
    6.   Dim x%
    7.   Dim ichange
    8.   Dim stitle$
    9.   Dim istart%, iend%
    10.   Dim endflag As Boolean
    11.  
    12. Private Sub Command1_Click()
    13.   If endflag = True Then
    14.     endflag = False
    15.   Else
    16.     endflag = True
    17.   End If
    18.   If endflag = False Then
    19.     istart = 1
    20.     For x = 1 To titlebar
    21.       DoEvents
    22.       Label1.Caption = Mid(title, 1, x)
    23.       Sleep 200
    24.     Next x
    25.     Do While endflag = False
    26.       If istart + titlebar < Len(title) + 1 Then
    27.         stitle = Mid(title, istart, titlebar)
    28.       Else
    29.         ichange = Len(title) - istart
    30.         stitle = Mid(title, istart, ichange) & Mid(title, 1, titlebar - ichange)
    31.       End If
    32.       Label1.Caption = stitle
    33.       DoEvents
    34.       If istart < Len(title) Then istart = istart + 1 Else istart = 1
    35.       Sleep 200
    36.      Loop
    37.   End If
    38.    
    39.  
    40. End Sub
    41.  
    42. Private Sub Form_Load()
    43.  endflag = True
    44.  title = "This is a test.  This is only a test..." ' Bar is 10 characters
    45.  titlebar = 27
    46.  Label1.Caption = ""
    47. End Sub

  3. #3
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    292

    Smile 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

  4. #4
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    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.

  5. #5
    Hyperactive Member
    Join Date
    Jun 2005
    Posts
    292

    Re: Scrolling text effect

    you could do it without a pbox couldnt you just move a label accross the screen

  6. #6
    Frenzied Member Devion's Avatar
    Join Date
    Sep 2000
    Location
    The Netherlands
    Posts
    1,049

    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
  •  



Click Here to Expand Forum to Full Width