VB icon

Another Progressbar without any OCX

Email
Submitted on: 2/6/2015 6:58:00 PM
By: Max Christian Pohle (from psc cd)  
Level: Beginner
User Rating: By 7 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 830
 
     It's just one Sub-Procedure that can fill a picturebox as if it was a progressbar. Also you can choose one of more than eight different styles!

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :Another Progressbar without any OCX
'**************************************
Sure that you -could- use APIs and please implement some if you want my progressbar to be transparent or anything. But don't be cruel and think my bar would be faster using them! :-)
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Another Progressbar without any OCX
' Description:It's just one Sub-Procedure that can fill a picturebox as if it was a progressbar. Also you can choose one of more than eight different styles!
' By: Max Christian Pohle (from psc cd)
'
' Inputs:Just call SetStatus as shown in my example (only included in the zip-file!).
----------------------------------------------------------------------
Call SetStatus() with the following Parameters:
1: The real Name of a (normal) Picturebox included in your project
2: Number of Percent to fill it with
and the following optional parameters are:
3: specify a style (1 to 7) for "fullfilling"...
4: specify a style (0 to 6) for the "lines-around" -can produce a 3D-effect
'
' Returns:a -hopefully- nicelooking progressbar
'
' Assumes:why i recommend you to use my code are the following facts:
- you dont need any OCX-File to use it
- it looks nice and gives your application an individual style
- my code does not run as slow as many others I have seen here *urgh* :-)
'**************************************

Sub SetStatus(Progressbar As Object, Percent As Integer, Optional Style As Integer, Optional Style2 As Integer)
Progressbar.AutoRedraw = True
Progressbar.Cls
Progressbar.FontTransparent = True
Progressbar.Tag = Percent
Progressbar.ScaleWidth = 100
Progressbar.ScaleHeight = 10
Progressbar.DrawStyle = Style2
Progressbar.DrawMode = 13
Progressbar.FillStyle = Style
Progressbar.Line (0, 0)-(Percent, Progressbar.ScaleHeight - 1), , BF
Progressbar.Line (0, 0)-(Percent, Progressbar.ScaleHeight - 1), , B
Progressbar.FontTransparent = False
Progressbar.CurrentX = 50 - Progressbar.TextWidth(Percent & "%")
Progressbar.CurrentY = (Progressbar.ScaleHeight / 2) - (Progressbar.TextHeight(Percent & "%") / 2)
Progressbar.FontBold = True
Progressbar.FontSize = 7
Progressbar.FontName = "Tahoma"
Progressbar.Print " " & Percent & "% "
End Sub


Other 8 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.