Write a C Program to display Progressbar (Graphics)
/****************************************************************************
* ProgressBar : This programm contains code for progressbar it work *
* same as progressbar displayed in window's environment. *
* (Progressbar for Graphics program) *
* ------------------------------------------------------------------------ *
* Author : Vivek Patel *
* Ahmedabad.INDIA *
* email : vivek_patel9@rediffmail.com *
* WWW : http://www.geocities.com/vivek_patel9/index.html *
* ------------------------------------------------------------------------ *
****************************************************************************/
#include
#include
#include
#include
#define CNT_ROW 5 //Counter in ProgressBar's --> Col position
#define CNT_COL 40 //Counter in ProgressBar's --> Row position
#define PROGRESS_X1 200//ProgressBar's --> Starting position
#define PROGRESS_X2 460//ProgressBar's --> Ending position
#define PROGRESS_Y1 55 //ProgressBar's --> Starting Height
#define PROGRESS_Y2 85 //ProgressBar's --> Ending Height
#define delayTime 50 //Speed of ProgressBar
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int i,j,cnt=0,clrflag=0;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
/*-------Introduction Line----------*/
setcolor(LIGHTGREEN);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
outtextxy(5,100,"Graphical ProgressBar");
setcolor(LIGHTCYAN);
settextstyle(SMALL_FONT,HORIZ_DIR,6);
outtextxy(5,180,"Programmed By : Vivek Patel");
outtextxy(5,200,"Email : vivek_patel9@rediffmail.com");
outtextxy(5,220,"Website : www.vivekpatel.cjb.net");
/*-------Introduction Line----------*/
setcolor(CYAN);
j=PROGRESS_X1;
cnt=5;
for(i=j;i
gotoxy(CNT_COL,CNT_ROW);
printf("%d",cnt);
rectangle(j,PROGRESS_Y1,i,PROGRESS_Y2);
if(i==(j+10)){
j=j+13;
i=j;
if(clrflag==1){
clrflag=0;
setcolor(CYAN);
}
else{
clrflag=1;
setcolor(BLUE);
}
cnt=cnt+5;
}
}
setcolor(WHITE);
outtextxy(5,260,"Press Any Key to Return...");
/* clean up */
getch();
// closegraph();
return 0;
}