VB怎么实现这个功能?

来源:百度知道 编辑:UC知道 时间:2024/06/21 06:59:51
我想实现一个功能,
我建了一个LABEL,一个COMMAND,
LABEL的Caption是"60",我想别人一打开我的EXE那个Label的Caption就变成59,再过一秒就变成58...如果那个Label的Caption变成了0之后,那个Command1就可以按,再没到0之前,不可以按Command1
为什么到0后还继续下去了?,我不要-1.-2.那些.

楼上的复杂了吧.....

Dim t1 As Integer

Private Sub Form_Load()
t1 = 60
Timer1.Interval = 1000
Timer1.Enabled = True
Command1.Enabled = False
End Sub

Private Sub Timer1_Timer()
t1 = t1 - 1
Label1.Caption = t1
If Label1.Caption = 0 Then Command1.Enabled = True
End Sub

窗体上再放一个Timer控件
代码如下
dim delay as integer
private sub form_load()
command1.enable=false
delay=60
timer1.interval=1000
timer1.enable=true
end sub

private sub timer1_timer()
if delay>= 0 then
delay=delay-1
else
command1.enable=true
timer1.enable=false
end if
label1.caption=delay
end sub

private sub command1_click()
form2.show
end sub

Form_onLoad()
Label.Caption=59
command.enable=false
End Form
加一个时钟控件,将触发时间设为1000,即1秒触发一次。
Time_Timer()
if Label.Caption>0 then
Label.C