VB高手快来!

来源:百度知道 编辑:UC知道 时间:2024/05/23 20:51:13
在一个窗体中,利用定时器控件(timer),控制这段文字"你好请帮帮我"在窗体中出现1分钟又消失1分钟,这题怎么做!

用1个Timer控件并将Timer控件的属性Interval设为60000约1分钟,代码如下:
Option Explicit
Dim timer_b As Boolean

Private Sub Timer1_Timer()
If timer_b Then
Label1.Caption = "你好,请帮帮我"
Else
Label1.Caption = ""
End If
timer_b = Not timer_b
End Sub

Dim nows, i As Integer

Private Sub Form_Load()
Print "你好,请帮帮我"
Me.AutoRedraw = True
End Sub

Private Sub Timer1_Timer()
i = i + 1
If i >= 60 Then
i = 0
If nows = 0 Then
Me.Cls
nows = 1
Else
Print "你好,请帮帮我"
nows = 0
End If
End If
End Sub

只需一个timer1,Interval为1000

可以用两个timer控件来实现,先把“你好请帮帮我”传给label1.text
先定义个变量i,j用来类加
在timer1的事件里写:
i+=1
if i=60 then
timer1.不可用
timer2.可用
i=0
else
label1.text(你好请帮帮我)可见

在timer2的事件里写:
j+=1
if j=60 then
timer1.可用