今天看CC写 SaMax 用到的,记录一下。


Private Sub ShowProgressBar(PicBox As PictureBox, iPercent As Integer, Color As Long)
'By JiaJia - PicBox 进度条
Static oPercent As Integer
Dim
x As Long, y As Long
Dim
fx As Long

If
iPercent = oPercent Then Exit Sub
If
iPercent < 0 Then iPercent = 0
If iPercent > 100 Then iPercent = 100
oPercent = iPercent

y = PicBox.Height
x = PicBox.Width
PicBox.Cls
'重画
fx = (oPercent / 100) * x '完成百分比
PicBox.Line (1, 1)-(fx, y), Color, BF
End Sub



Rem 从 Min 和 Max 中获取 Val 的百分比
Function ValuePercent(ByVal lngMin As Long, ByVal lngMax As Long, ByVal lngVal As Long) As Long
Dim
lngM As Long, lngV As Long
lngM = lngMax - lngMin
lngV = lngVal - lngMin
If lngM = 0 Then Exit Function
ValuePercent = CLng((lngV) / (lngM / 100))
End Function

Rem 从百分比中取得 从 Min 和 Max 的Value
Function PercentValue(ByVal lngMin As Long, ByVal lngMax As Long, ByVal lngPercent As Long) As Long
Dim
lngM As Long
lngM = lngMax - lngMin + 1
PercentValue = CLng(lngM * (lngPercent / 100) + lngMin)
End Function


 
目前有0条回应
Comment
Trackback
你目前的身份是游客,请输入昵称和电邮!