Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Computer GraphicsRSS Feeds

Program to display progress bar as displayed in windows system

Posted By: Easy Tutor     Category: C Programming     Views: 5215

Write a Program to display progress bar as displayed in windows system.

Code for Program to display progress bar as displayed in windows system in C Programming

/*   ProgressBar : This programm contains code for progressbar it work                       same as progressbar displayed in window's environment.                    (Progressbar for Graphics program)                        */



#include <graphics.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>

#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 ProgressBarint 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 : Talented programmer");
   outtextxy(5,200,"Email : admin@syntaxexample.com");
   outtextxy(5,220,"Website : www.syntax-example.com");
   /*-------Introduction Line----------*/

   setcolor(CYAN);
   j=PROGRESS_X1;
   cnt=5;
   for(i=j;i<PROGRESS_X2;i++){
      delay(delayTime);
      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;
}

  
Share: 



Easy Tutor
Easy Tutor author of Program to display progress bar as displayed in windows system is from United States. Easy Tutor says

Hello Friends,

I am Free Lance Tutor, who helped student in completing their homework.

I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.

I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] com

I have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada.

I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.

Thanks,
Happy Programming :)

 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!