This topic explains how to use a progress bar to indicate the progress of a lengthy file-parsing operation.
Create a Progress Bar Control
Progress Bar |
The following example code creates a progress bar and positions it along the bottom of the parent window's client area. The height of the progress bar is based on the height of the arrow bitmap used in a scroll bar. The range is based on the size of the file divided by 2,048, which is the size of each "chunk" of data that is read from the file. The example also sets an increment and advances the current position of the progress bar by the increment after parsing each chunk.
Source Code
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int x=170,i,gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(170,180,"LOADING,PLEASE WAIT");
for(i=0;i<300;++i)
{
delay(30);
line(x,200,x,220);
x++;
}
getch();
closegraph();
}
0 comments:
Post a Comment