VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Progress Bar Non-OCX

by Slikk (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

Fill the progressbar up to the percent given.

Assumes
You need to add the PictureBox to a form and that's about it.
Code Returns
Progressbar value.

Rate Progress Bar Non-OCX

'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)

Download this snippet    Add to My Saved Code

Progress Bar Non-OCX Comments

No comments have been posted about Progress Bar Non-OCX. Why not be the first to post a comment about Progress Bar Non-OCX.

Post your comment

Subject:
Message:
0/1000 characters