怎样在程序启动界面上制作一个进度条???
来源:百度知道 编辑:UC知道 时间:2024/05/27 00:44:44
将启动窗体中加入一个timer,一个进度条,代码如下:
Dim i As Integer
Private Sub Form_Load()
i = 0
Timer1.Enabled = True
Timer1.Interval = 200
ProgressBar1.Max = 5000 '启动窗体等待的ms数
End Sub
Private Sub Timer1_Timer()
i = i + Timer1.Interval
If i > ProgressBar1.Max Then
Load frmlogin
frmlogin.Show '加载登录窗体
Unload Me '卸载启动窗体
Else
ProgressBar1.Value = i
End If
End Sub
在工程菜单-部件中找Microsoft Windows Common Controls 6.0打钩
添加ProgressBar到窗体..下面我把进度条改名为 PB1
再建立一个Timer1
代码如下
Private Sub Form_Load()
Timer1.Interval = 100
PB1.Max = 30
PB1.Min = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Show '主界面窗体
End Sub
Private Sub Timer1_Timer()
Static wait%
wait = wait + 1
If wait >= 30 Then
wait = 0
PB1.Value = 0
Unload Me
Else
PB1.Value = PB1.Value +