VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Another Progressbar without any OCX

by Max Christian Pohle (9 Submissions)
Category: Coding Standards
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (7 Votes)

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!

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
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* :-)
Code Returns
a -hopefully- nicelooking progressbar
API Declarations
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! :-)

Rate Another Progressbar without any OCX


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

Download this snippet    Add to My Saved Code

Another Progressbar without any OCX Comments

No comments have been posted about Another Progressbar without any OCX. Why not be the first to post a comment about Another Progressbar without any OCX.

Post your comment

Subject:
Message:
0/1000 characters