在VB窗体中依次显示文字

来源:百度知道 编辑:UC知道 时间:2024/06/17 19:23:14
怎样在VB中依次显示文字?例如:北京欢迎您
是要用到TIMER吗?请给我完整的代码!
挺急的
谢谢!!

建一个timer1,再建一个label1控件数组,一行排开。label1控件数组的创建方法如下:
新建一个Label1,复制它,在窗体内粘贴时,同意创建控件数组,粘贴4次,这样一共就5个Label1啦

Private Sub Form_Activate()
For i = 0 To 4
Label1(i).Caption = Mid("北京欢迎你", i + 1, 1)
Label1(i).Visible = False
Next
Timer1.Enabled = True
Timer1.Interval = 500
End Sub

Private Sub Timer1_Timer()
Static k As Integer
Seen k
k = k + 1
If k > 4 Then k = 0
End Sub

Private Sub Seen(ByVal n As Integer)
For i = 0 To 4
Label1(i).Visible = False
Next
Label1(n).Visible = True
Label1(n).ForeColor = QBColor(Int(16 * Rnd))
End Sub

这么简单
就是加入TIMER
注意TIME的赋值就是了