VB.NET打字机效果

时间:2012-06-20 13:55:33

标签: vb.net winforms

我想让打字机效果如下:
http://img139.imageshack.us/img139/9775/screenshot0002mm2.gif

dim s as string = "123"
label1.text = s.substring(0,1)
WAIT
label1.text = s.substring(0,2)
WAIT
label1.text = s.substring(0,3)

2 个答案:

答案 0 :(得分:3)

Public str As String
Public count As Integer

Form1_Load的:

 Label1.Text = ""
 count = 1
 str = ":D test 12345678910"
 Timer1.Enabled = True

timer_tick:

If Label1.Text.Length = str.Length Then
    Timer1.Enabled = False
    Exit Sub
End If
Label1.Text = str.Substring(0, count)
count = count + 1

只需使用计时器:)

答案 1 :(得分:0)

宣告计时器:

对于字符串

中的每个字符

console.writeline(character)

//或者您可以将其写入文本框。 Textbox.text = Textbox.text&字符

添加时间(您可以设置每个字符之间的延迟)

结束