Private Sub Command1_Click()
Timer1.Enabled = True
h = Text1.Text
min = Text2.Text
sec = Text3.Text
Timer2.Enabled = False
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Form1.BackColor = &HFFFF00
Timer1.Enabled = False
Timer1.Interval = 1000
Timer2.Enabled = True
Timer2.Interval = 1000
Text1.Text = 2
Text2.Text = "00"
Text3.Text = "00"轮握
Command2.Caption = "腊册庆退出"
Command1.Caption = "开始倒计时"姿罩
End Sub
Private Sub Timer1_Timer()
If sec >0 Then
sec = sec - 1
Else:
If (min >0 Or h >0) Then
sec = 59
End If
If min >0 Then
min = min - 1
Else:
If h >0 Then
min = 59
End If
If h >0 Then
h = h - 1
Else: Timer1.Enabled = False
CreateObject("SAPI.SpVoice").Speak "GAME OVER!"
Form1.BackColor = &HFF
End If
End If
End If
Text1.Text = h
Text2.Text = min
Text3.Text = sec
Label6.Caption = Now
End Sub
Private Sub Timer2_Timer()
Label6.Caption = Now
End Sub
在窗体添判帆加3个文本框、一个Label和一个按钮,不要修改他们的名称,然后写代掘返雹码如下:Private Sub Command1_Click()
Dim H As Single,M As Single,N As Single,T As Single
H=Text1.text
M=Text2.text
N=Text3.text
T=H/(M-N)
Label1.Caption="青蛙从高" &H "米的井中爬出需要" &T &"天"
End Sub
运行程序,在3个文本框分别世悉输入H,M和N,就可以在Label1中看到结果
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)