VB6.0中带进度条的倒计时怎么做
1个回答
展开全部
在窗体上画一个Timer控件、一个按钮,一个ProgressBar控件(需要添加部件Microsoft Windows Common Controls 6.0),用下面的代码,单击按钮开始10秒倒计时。
Private Sub Command1_Click()
Timer1.Enabled = True
ProgressBar1.Value = ProgressBar1.Max
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
ProgressBar1.Value = ProgressBar1.Max
End Sub
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value - 10
If ProgressBar1.Value <= 0 Then
Timer1.Enabled = False
MsgBox "10秒倒计时结束!"
End If
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
ProgressBar1.Value = ProgressBar1.Max
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1000
ProgressBar1.Value = ProgressBar1.Max
End Sub
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value - 10
If ProgressBar1.Value <= 0 Then
Timer1.Enabled = False
MsgBox "10秒倒计时结束!"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询