Progress bars everywhere you look
I’ve created Visual FoxPro progress bars before (who among us hasn’t right?). The last time I developed one, I posted it over in the download section of Universal Thread. It is a COM server progress bar that allows progress indication to smoothly continue even when Visual FoxPro is busy churning away on a single line of code. But in today’s project, I set out to create a simpler progress bar that could be placed in a container (form or whatever).
Another progress bar class
I wanted this progress bar to look really professional. I also wanted it to handle being resized to any length or width by the developer during design. I then wanted it to either do a solid bar or create individual blocks like we see in the standard Windows XP progress bar and I wanted it to have the ability to show the percentage complete with a label that would change color as the progress bar went over the top of it (so at 50%, half of the 50% is one color and the other half another). Finally it had to be able to display different colors (green as in Windows XP, as well as red and blue). These are all features I’ve seen in other progress bars, and felt that Visual FoxPro could use one too.
Progressbar properties of note
barcolor = The color you want the progress bar to be: 1 = Red, 2 = Green, 3 = Blue (defaults to 2)
min = The value to be considered 0% (defaults to 0)
max = The value to be considered 100% (defaults to 100)
percentage = The percentage complete based on the current value assigned (defaults to 0)
showpercentage = Whether the percentage should be displayed to the user (defaults to .F.; best used when solidbar is .T.)
solidbar = Whether progress bar should be shown as a solid as opposed to blocks (defaults to .F.)
value = The current value of the progress (defaults to 0; should fall within the min and max range)
Other development notes
The gradient look of the progress bar was created by dynamically adding lines of varying degrees of color. The percentage showing through the progress bar was facilitated by setting the drawmode property of the lines to 14 – Merge Pen Not.
Download the project
You can either run the progressbarex.exe or you can open the project and run the example.scx. Everything is included in the download. Here is the download link and a screen shot of the included example…
Download ProgressbarEx Example and Source (26 KB approx.)