home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
PERMETER.ZIP
/
METER.TXT
< prev
next >
Wrap
Text File
|
1994-03-02
|
2KB
|
41 lines
This is a sample on how to make a percent bar in your VB apps without
using third party add ons. This is a basic sample that is designed to
get you going.
The code contains a sub called FillMeter which has 2 parameters passed
to it, the total and the value to update to. The total is the value that
will show "100%" in the percent bar. Example- if you are going to
process a list box that contains 15 items , then the total would be 15,
or if you are going to call 4 subs or functions, the total would be 4.
The value is the aamount to update to. Example- if you have a list box
with 15 items and you are processing the 2nd item, the value would be 2,
or if you are going to call 4 subs or functions and you are current on
the 2nd sub, your value would be 2.
FillMeter will calculate the length of the line to draw by using these
values. Example- If your total is 15 and you pass a value of 5 to update
to, then 5/15 would be approx. .15 or 15%. Then it draws a line that is
15% of the width of the percent bar.
The percent bar is a simple picture box that has the FontTransparent set
to false. If this were set to true, then each time you printed the value
of the percent (ex. "15 %") in the percent bar, it would overlap the
previous value. (To see this , set the FontTransparent to true and run
the code). At about 45% we can change the font to transparent because
the line being drawn will correct this (again try this out in the code
to see the difference).You can get around this be clearing the picture box
before you draw the line, but this causes alot of screen flutter (Try it out
to see).
When the value hits 100%, we then change the FontTransparent back to
false and clear the picture box.
The code contains to sample of using the percent sample, a simple timer
and a sample of using listboxes. This again is just a basic start, you
can modify it for your own needs.
Thats about it, you are allowed to modify this code any way you wish and
use it as long as you remember one thing, "I CAN NOT BE HELD
RESPONSIBLE FOR ANY DAMAGE CAUSED BY THIS CODE". Pretty basic
disclaimer, have fun and enjoy it!