Postup:
V deklarační části formuláře zapište:
Sub delay(time)
Start = Timer
Do While Timer - Start < time
DoEvents
Loop
End Sub
Private Sub TypingEffect(msg As String, time)
Dim msgLen As Integer
Dim currIndex As Integer
Dim currChar As String
Dim currText As String
msgLen = Len(msg)
Do While currIndex <= msgLen
DoEvents
currIndex = currIndex + 1
currChar = Mid(msg, currIndex, 1)
currText = currText & currChar
Text1.Text = currText
delay time
DoEvents
Loop
End Sub
Na formulář přidejte
TextBox (Text1) a tlačítko. Na událost Click tlačítka:
Private Sub Command1_Click()
TypingEffect "The Bozena Software Ltd.", 0.15
End Sub
|