ProgressListBox




Dim CurrentPercent As Integer
Private Sub Command1_Click()
Dim lstEntry As ListItem
ListView1.ListItems.Add , , "Q3Demo.zip"
ListView1.ListItems.Item(1).SubItems(1) = ""
'lstEntry.SubItems(1) = ""

'lstEntry.ListSubItems.Item(1).ReportIcon = 0

Timer1.Enabled = True
End Sub
'_________________________________________________________


Public Function UpdateProgress(pb As Control, ByVal Percent)
'Replacement for progress bar..looks nicer also

Dim Num$ 'use percent
If Not pb.AutoRedraw Then 'picture in memory ?
pb.AutoRedraw = -1 'no, make one
End If
pb.Cls 'clear picture in memory
pb.ScaleWidth = 100 'new sclaemodus
pb.DrawMode = 10 'not XOR Pen Modus
Num$ = Format$(Percent, "###") + "%"
pb.CurrentX = 50 - pb.TextWidth(Num$) / 2
pb.CurrentY = (pb.ScaleHeight - pb.TextHeight(Num$)) / 2
pb.Print Num$ 'print percent
pb.Line (0, 0)-(Percent, pb.ScaleHeight), , BF
pb.Refresh 'show differents
End Function
'_________________________________________________________


Private Sub Timer1_Timer()
'On Error Resume Next

CurrentPercent = CurrentPercent + 1
If CurrentPercent < 101 Then
UpdateProgress Picture1, CurrentPercent
'First unbound

ListView1.SmallIcons = Nothing
'Next Make changes to imagelist1

ImageList1.ListImages.Clear
ImageList1.ListImages.Add , , Picture1.Image
'After Rebound it listview

ListView1.SmallIcons = ImageList1
ListView1.ListItems.Item(1).ListSubItems.Item(1).ReportIcon = 1
Else
Timer1.Enabled = False
CurrentPercent = 0
End If

End Sub











( progresslistbox.html )- by Paolo Puglisi - Modifica del 17/12/2023