VB 进度条控件控制
发布网友
发布时间:2022-05-02 00:11
我来回答
共2个回答
热心网友
时间:2022-06-25 10:34
添加控件textbox一个,progressbar一个,按钮2个 ,timer一个,复制以下代码即可:
Option Explicit
Dim n As Integer
Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Command2_Click()
If Val(Text1) <= 0 Then Exit Sub
Text1 = Val(Text1) - 1
ProgressBar1.Value = n - Val(Text1)
End Sub
Private Sub Text1_LostFocus()
n = Val(Text1)
If n <= 0 Then MsgBox "text1不能为0": Exit Sub
ProgressBar1.Max = Val(Text1)
End Sub
Private Sub Timer1_Timer()
Text1.Text = Val(Text1) - 1
ProgressBar1.Value = n - Val(Text1)
If Val(Text1) <= 0 Then Timer1.Enabled = False
End Sub
热心网友
时间:2022-06-25 10:35
等差数列问题