|
不光是模拟进度条,还支持字符反显
源代码网址:
http://www.extencent.com/show.asp?id=199
源代码:
'代码经过测试,不闪烁
- Public Sub SetProgress(PBar As PictureBox, ByVal Value As Long, ByVal Max As Long, Optional ByVal Describe As String = "")
- Dim showText As String
- Dim drawLength As Long
-
- drawLength = (Value * PBar.ScaleWidth / Max)
-
- If Describe = "" Then
- showText = Format(Value * 100 / Max, "#0.00") & "%"
- Else
- showText = Describe
- End If
-
- With PBar
- .AutoRedraw = True
- .Cls
- .CurrentX = (.ScaleWidth - .TextWidth(showText)) / 2
- .CurrentY = (.ScaleHeight - .TextHeight(showText)) / 2
- .FontBold = True
- PBar.Print showText
- .DrawMode = 8
- PBar.Line (0, 0)-(drawLength, .ScaleHeight), Not RGB(51, 153, 255), BF
- .AutoRedraw = False
- .Refresh
- End With
- End Sub
复制代码 |
|