09-05-2012، 12:23 PM
'Write in module
'Test in Timer Control
کد:
Dim Cl As Integer
Dim at As Integer
Public Function AniText(str As String, eff As Integer) As String
Dim lop
Cl = Len(str) + 1
at = at + 1
If at >= Cl Then
at = 1
End If
Select Case eff
Case 0 'Move to Right
AniText = Mid(str, at) + Left(str, at)
Case 1 'Move to Left
AniText = Mid(str, (Cl - at)) + Left(str, (Cl - at))
Case 2 'Move to Centre
AniText = Mid(str, (Cl - at)) + Left(str, (Cl - at)) + Mid(str, at) + Left(str, at)
Case 3 'Move to BothSide
AniText = Mid(str, at) + Left(str, at) + Mid(str, (Cl - at)) + Left(str, (Cl - at))
End Select
End Function
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
کد:
Private Sub Timer1_Timer()
Form1.Caption = AniText(" Welcome to Visual Basic", 1)
End Sub