VB icon

Caption Animation - Timer Control

Email
Submitted on: 1/26/2015 6:34:00 PM
By: Ross Ylitalo (from psc cd)  
Level: Beginner
User Rating: By 2 Users
Compatibility: VB 6.0
Views: 538
 
     Beginner level discussion on proper use of the Timer Control. Give your About Box a bit of sex appeal.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Caption Animation - Timer Control
' Description:Beginner level discussion on proper use of the Timer Control. Give your About Box a bit of sex appeal.
' By: Ross Ylitalo (from psc cd)
'**************************************

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


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.