VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Caption Animation Timer Control

by Ross Ylitalo (1 Submission)
Category: Coding Standards
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

Beginner level discussion on proper use of the Timer Control. Give your About Box a bit of sex appeal.

Rate Caption Animation Timer Control

Private m_strFullCaption As String
Private m_strCurrentCaption As String
Private m_ynLeftRight As Boolean
Private Sub Form_Load()
  m_strFullCaption = Me.Caption ' Don't mutate m_strFullCaption after this!
  Me.Caption = ""
  m_strCurrentCaption = ""
  m_ynLeftRight = True
End Sub
Private Sub tmr_Timer()
  If m_ynLeftRight Then
    ' Show caption from left to right.
    If Len(m_strCurrentCaption) < Len(m_strFullCaption) Then
      m_strCurrentCaption = Left(m_strFullCaption, Len(m_strCurrentCaption) + 1)
      Me.Caption = m_strCurrentCaption
    Else
      m_ynLeftRight = Not m_ynLeftRight
    End If
  Else
    ' Scroll caption off of screen, scrolling Left.
    If Len(m_strCurrentCaption) > 0 Then
      m_strCurrentCaption = Right(m_strFullCaption, Len(m_strCurrentCaption) - 1)
      Me.Caption = m_strCurrentCaption
    Else
      m_ynLeftRight = Not m_ynLeftRight
    End If
  End If
End Sub

Download this snippet    Add to My Saved Code

Caption Animation Timer Control Comments

No comments have been posted about Caption Animation Timer Control. Why not be the first to post a comment about Caption Animation Timer Control.

Post your comment

Subject:
Message:
0/1000 characters