Caption Animation - Timer Control
Beginner level discussion on proper use of the Timer Control. Give your About Box a bit of sex appeal.
AI
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Zdrojový kód
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
Původní komentáře (3)
Obnoveno z Wayback Machine