Progress BarsProgess bars are just about as easy as static controls to implement, since they only take a few messages. Basically, you need to do two things with a progress bar - you need to tell it a min/max range, and you need to tell it to "step" some number of units. For example, say I wanted to put up a "Loading…" progress bar, because I had to load 100 different game resources. I would create a progress bar with a range of 0 to 100. I would initially set the progress bar to zero, then, whenever I loaded a game resource, I would "step" the progress bar by one unit. Whenever the progress bar was stepped, it would redraw itself, showing graphically how far along it was by displaying a bar whose length was proportionate to its client area. Progress bars are very similar to scroll bars; in fact, it might make sense to implement your progress bars in terms of your scroll bars. I made my progress bar separate from my scroll bars simply because I wanted the two to have drastically different appearances and slightly different behaviors - your needs may be different.
|
|