Thread: Progress Bar
View Single Post
  #4 (permalink)  
Old December 19th, 2005, 08:12 PM
marcostraf marcostraf is offline
Friend of Wrox
Points: 1,254, Level: 14
Points: 1,254, Level: 14 Points: 1,254, Level: 14 Points: 1,254, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I set the BackColor and ForeColor of the PictureBox to something like White and Blue. Then I use the Scale property to set the range of the progress bar (equivalent to the Max property of the scrollbar) like:

picture.scale (0,0)-(maxVal,1)

if the progress bar is horizontal, otherwise

picture.scale (0,0)-(1,maxVal)

And then in the picture Paint event:

Picture.Line (0, 0)-(pValue, 1), , BF

(horizontal) where pValue is the current progress value.

This is the concept. Playing with the paint event, it is possible to get other fancy effects. I wrapped all the code in a nice class, so that I can add more properties as needed.

Marco
Reply With Quote