Subject: Progress Bar
Posted By: jmss66 Post Date: 12/19/2005 2:57:09 PM
Hi Guys,

I wanted to add a progress bar in my project. I don't remember which component I needed to add. I was looking for anything that resembles progress bar or any Active X control but I can't seem to find it. Can someone please help me add a progress bar to my project.

Thanks,
Judy

Reply By: marcostraf Reply Date: 12/19/2005 4:07:15 PM
It's in mscomctl.ocx, that you can include using the Components dialog (Ctrl+T) selecting:

Microsoft Windows Common Control 6.0 (SP3)

or whatever service pack you have.

Marco

BTW I do not like that control at all. I prefer make my own using a simple PictureBox, because I can add much more flexibility.
Reply By: jmss66 Reply Date: 12/19/2005 4:22:35 PM
Hi Macro,

Thanks. I was able to add it in. I am interested in what you said about creating your own using a picture box. Do you have any samples of code or any site that has this?

Thanks,
Judy

Reply By: marcostraf Reply Date: 12/19/2005 7:12:55 PM
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 By: jmss66 Reply Date: 12/27/2005 3:55:49 PM
Hi Macro,

I'll play with this code. Thanks again for your help.

Judy


Go to topic 38004

Return to index page 409
Return to index page 408
Return to index page 407
Return to index page 406
Return to index page 405
Return to index page 404
Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400