【问题标题】:VB.NET typewriter effectVB.NET打字机效果
【发布时间】:2012-06-20 13:55:32
【问题描述】:

我想让打字机效果像:
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)

【问题讨论】:

    标签: vb.net winforms


    【解决方案1】:
    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
    

    只需使用计时器 :)

    【讨论】:

    • 错误:未声明“Label1”。由于其保护级别,它可能无法访问。
    • 在表单中添加标签控件
    【解决方案2】:

    声明计时器:

    对于字符串中的每个字符

    console.writeline(字符)

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

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

    结束

    【讨论】:

      猜你喜欢
      • 2020-04-02
      • 1970-01-01
      • 1970-01-01
      • 2011-03-26
      • 2016-08-31
      • 1970-01-01
      • 1970-01-01
      • 2012-10-30
      相关资源
      最近更新 更多