VB6“正在登录”进度条如何做的?

来源:百度知道 编辑:UC知道 时间:2024/05/15 08:45:39
VB6检测远程服务器,如果IP或网址打开(或返回什么信息正确),则显示“正在登录,请稍候...”,以及进度条,那是如何做的?

感谢帮忙,请写出源码。
玻璃鱼V的代码可实现进度条,请问如何在其中添加触发条件,也即当网址正确或IP正确或远程返回信息正确的时候触发到完成状态?

提供两种思路:第一种是模仿X-SCAN的进度条的,不过稍有逊色:

'添加一个Timer,Interval设为1
'一个PictureBox,名称是P1 ——TZW

Dim d As Single

Private Sub Form_Load()
d = P1.Width / 255
P1.AutoRedraw=True
End Sub

Private Sub Timer1_Timer()
Static c As Long
DrawPic c, d
If c <= 0 Then d = P1.Width / 255
If c >= P1.Width Then
d = -(P1.Width / 255)
End If
c = c + d
End Sub

Sub DrawPic(ByVal Pos As Long, ByVal a As Single)
Dim b As Byte
b = 255: P1.Cls
Do Until b = 0
If Pos <= 0 Then a = P1.Width / 255
If Pos >= P1.Width Then a = -(P1.Width / 255)
P1.Line (Pos, 0)-(Pos + a, P1.Height), RGB(b, b, b), BF
Pos = Pos + a: b = b - 1
Loop
End Sub

第二种是 VB吧 的CBM666老师给的代码:

'工程部件里添加 Microsoft Windowd common controls6.0(sp4)
'添加 Picture1 ProgressBar1 Command1 3 个控件

Priva