各位高手 ,你们好
    本人在做游戏中, 现在有一个这样的问题, 比如游戏里出现一重大事件(死亡)
即触发某一窗体, 然后会有一条文字出现在窗体上, 
要求字是一个接一个显示在窗体上的标签里的,  貌似美文浏览器 ,不知道是否可以做。

解决方案 »

  1.   

    当然可以,用timer控件,随着时间的改变
       label1.caption="你"
       label1.caption="你牺"
       label1.caption="你牺牲"
       label1.caption="你牺牲了"
      
      

  2.   

    不行 楼上的楼上运行了吗? 必须用timer控件
      

  3.   

    Private Declare Function GetTickCount Lib "kernel32" () As LongDim starTime As Long
    Private Sub Command1_Click()
        Timer1.Interval = 1000
        Timer1.Enabled = True
        starTime = GetTickCount
        Label1.Caption = "你"
    End SubPrivate Sub Form_Load()
        Timer1.Enabled = False
    End SubPrivate Sub Timer1_Timer()
        If (GetTickCount - starTime) > 1000 Then
            Label1.Caption = "你挂"
        End If
        If (GetTickCount - starTime) > 2000 Then
            Label1.Caption = "你挂啦"
        End If
        If (GetTickCount - starTime) > 3000 Then
            Label1.Caption = "你挂啦!哈"
        End If
         If (GetTickCount - starTime) > 4000 Then
            Label1.Caption = "你挂啦!哈哈!"
        End If
    End Sub
      

  4.   

    改进:
    Private Declare Function GetTickCount Lib "kernel32" () As LongDim starTime As Long, i As Long
    Private Sub Command1_Click()
        Timer1.Interval = 50
        starTime = GetTickCount
        i = 1
        Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
        Timer1.Enabled = False
        Label1.Caption = ""
    End SubPrivate Sub Timer1_Timer()
        Dim strTip As String
        strTip = "你挂啦!哈哈!"
        If (GetTickCount - starTime) > i * 1000 Then
            Label1.Caption = Label1.Caption & Mid(strTip, i, 1)
            i = i + 1
        End If
    End Sub
      

  5.   

    我把原先 form_load 里的代码写到 form _initicize 
        command_click 里的代码写到form_load没问题吧 .
    呵呵, 循环是必然的啊. 
    只是除了循环 ,还设计字符处理函数嘛 ,后者我不大熟悉啊  :)
    多谢指教 !!!
      

  6.   

    如果不想窗体一装载就开始显示,那直接这样:
    Private Sub Form_Load()
        Timer1.Interval = 50
        starTime = GetTickCount
        i = 1
        Label1.Caption = ""
    End SubPrivate Sub Timer1_Timer()
        Dim strTip As String
        strTip = "你挂啦!哈哈!"
        If (GetTickCount - starTime) > i * 1000 Then
            Label1.Caption = Label1.Caption & Mid(strTip, i, 1)
            i = i + 1
        End If
    End Sub
      

  7.   

    首先将要滚动显示的文字赋给一个字符串变量(设为str),假设在lable控件上显示这些文字,在timer_tick中用如下代码:
    static i as int16
    if i<str.length then
      lable.text=str.substring(0,i)
      i+=1
    else
      i=0
    end if
      

  8.   

    上面的"i<str.length"改为“i<=str.length”