Progress Bar Non-OCX
Posted: 2003-06-01
By: ArchiveBot
Viewed: 79
Filed Under:
No attachments for this post
Fill the progressbar up to the percent given.
Original Author: Slikk
Assumptions
You need to add the PictureBox to a form and that's about it.
Returns
Progressbar value.
Code
'Visit: http://slikk.emunx.net/ or http://slikk.emunx.net/forum and support our site, we just got it up and running and we need visitors, thanks.
Public Sub UpdateProgress(pBar As PictureBox, Percent As Single, Optional ByVal ShowPercent = False)
Dim sData As String
If Not pBar.AutoRedraw Then '//no memory?
pBar.AutoRedraw = -1 'nope, we make some
End If
pBar.Cls '//clear memory
pBar.ScaleWidth = 100 'set scale's width
pBar.DrawMode = 10 '//set draw modus
If ShowPercent = True Then
sData$ = Format(Percent, "###0") + "%" '//format percent
pBar.CurrentX = 50 - pBar.TextWidth(sData$) 'set the currentX for the progress
pBar.CurrentY = pBar.ScaleHeight - pBar.TextHeight(sData$) 'set the currentY for the progress
Debug.Print sData$ 'show percent in debug window
End If
pBar.Line (0, 0)-(Percent, pBar.ScaleHeight), , BF
pBar.Refresh
End Sub
'Call UpdateProgress (Picture1, 50, False)
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.