hi guys i am doing a project and i need so help plzzz
http://s891.photobucket.com/albums/ac111/redblood_bucket/?action=view&current=uu_000.png
at this link u can find a pic this a small part of my project the problem is that i want everything that i type or want to display like welcome to the back blah blah should stay in the blue box plzzzz help me with dis where is the source code of the pic

void display()
{int driver,mode;
driver=DETECT;
mode=DETECT;
initgraph(&driver,&mode,"\\TC\\bgi" );

int d[35];
  d[0]=122; d[1]=135;d[2]=122;d[3]=37;d[4]=143;d[5]=16;d[6]=172;d[7]=0;
  d[8]=546;d[9]=0;d[10]=574;d[11]=13;d[12]=598;d[13]=37;d[14]=598;d[15]=255;
  d[16]=536;d[17]=282;d[18]=534;d[19]=380;d[20]=534;d[21]=380;d[22]=492;d[23]=410;
  d[24]=230;d[25]=410;d[26]=185;d[27]=380;d[28]=185;d[29]=282;d[30]=122;d[31]=258;
  d[32]=122;d[33]=135;
  setfillstyle(SOLID_FILL,RED);
    fillpoly(17,d);
     int a[18];
    a[0]=200;a[1]=255;a[2]=280;a[3]=255;a[4]=520;a[5]=255;a[6]=520;a[7]=370;
  a[8]=490;a[9]=390;a[10]=230;a[11]=390;a[12]=200;a[13]=370;a[14]=200;a[15]=255;
  a[16]=200;a[17]=255;
  setfillstyle(SOLID_FILL,DARKGRAY);
    fillpoly(9,a);

    int b[19];

  b[0]=410;b[1]=260;b[2]=440;b[3]=260;b[4]=515;b[5]=260;b[6]=515;b[7]=260;
  b[8]=515;b[9]=285;b[10]=515;b[11]=315;b[12]=515;b[13]=365;b[14]=410;b[15]=365;
  b[16]=410;b[17]=260;
  setfillstyle(SOLID_FILL,BLACK);
  fillpoly(9,b);
  int c[23];
  setcolor(WHITE);
  c[0]=130;c[1]=135;c[2]=130;c[3]=40;c[4]=150;c[5]=20;c[6]=180;c[7]=5;
  c[8]=540;c[9]=5;c[10]=570;c[11]=20;c[12]=590;c[13]=40;c[14]=590;c[15]=235;
  c[16]=540;c[17]=220;c[18]=180;c[19]=220;c[20]=130;c[21]=235;
  setfillstyle(SOLID_FILL,BLACK);
  fillpoly(11,c);
  line(130,40,122,37);
   line(150,20,143,16);
   line(180,5,172,0);
   line(540,5,546,0);
   line(570,20,574,13);
   line(590,40,598,37);
   line(597,254,590,235);
   line(520,255,536,282);
   line(521,370,534,380);
   line(490,390,492,410);
   line(230,390,230,410);
   line(200,370,185,380);
   line(200,255,185,282);
   line(124,258,130,235);


   //screen
   int p[30];
   setcolor(9);
   p[0]=150;   p[1]=45; p[2]=180; p[3]=20; p[4]=540; p[5]=20; //1 ST SCREEN
  p[6]=570; p[7]=45; p[8]=570; p[9]=185; p[10]=540; p[11]=210;
  p[12]=180; p[13]=210; p[14]=150; p[15]=185; p[16]=150;   p[17]=45;
 setfillstyle(SOLID_FILL,GREEN);
  fillpoly(9,p);
  rectangle(160,50,460,90);
  p[0]=160;   p[1]=45; p[2]=180; p[3]=30; p[4]=540; p[5]=30;  //MAIN SCREEN
   p[6]=560; p[7]=45; p[8]=560; p[9]=185; p[10]=540; p[11]=200;
    p[12]=180; p[13]=200; p[14]=160; p[15]=185;
  setfillstyle(SOLID_FILL,BLUE);
  fillpoly(8,p);

    //oh crap this is crazy stuff
button_u(280,365,310,390,0,7,"0");
button_u(215,260,240,285,0,7,"1");
button_u(280,260,310,285,0,7,"2");
button_u(350,260,380,285,0,7,"3");
button_u(215,298,240,323,0,7,"4");
button_u(280,298,310,323,0,7,"5");
button_u(350,298,380,323,0,7,"6");
button_u(215,335,240,360,0,7,"7");
button_u(280,335,310,360,0,7,"8");
button_u(350,335,380,360,0,7,"9");
button_u(450,262,475,287,0,7,"À");
button_u(485,262,510,287,0,7," ");
button_u(415,298,440,323,0,7,"½");
button_u(445,298,480,323,0,7,"ok");
button_u(485,298,510,323,0,7,"Á");
button_u(450,335,475,360,0,7,"»");
getch();

    }
void button_u(int left,int top,int right,int bottom,int colo,int co,char*di="")
{
int x1,x2,x3,x4,s[20];
setcolor(LIGHTBLUE);
rectangle(left,top,right,bottom);
x1=left+3;
x2=top+3;
x3=right-3;
x4=bottom-3;
setcolor(LIGHTBLUE);
s[0]=x1; s[1]=x2;s[2]=x3;s[3]=x2;s[4]=x3;s[5]=x4;s[6]=x1;s[7]=x4;s[8]=x1;s[9]=x2;
setfillstyle(SOLID_FILL,colo);
fillpoly(5,s);
setcolor(WHITE);

setlinestyle(0,1,2);
line(left,top,x1,x2);
line(right,top,x3,x2);
line(left,bottom,x1,x4);
line(right,bottom,x3,x4);
settextstyle(4,0,1);
setcolor(co);
moveto(((x1+x3)/2)- 4,((x4+x2)/2)-14);
outtext(di);
setcolor(LIGHTGRAY);
for(int i=1;i<3;i++)
line(left+i,top+i,right-i,top+i);

for(i=1;i<3;i++)
line(left+i,top+i,left+i,bottom-i);
setcolor(BLACK);
for(i=1;i<3;i++)
line(right-i,top+i,right-i,bottom-i);
for(i=1;i<3;i++)
line(left+i,bottom-i,right-i,bottom-i);
setcolor(LIGHTBLUE);
line(left,top,x1,x2);
line(right,top,x3,x2);
line(left,bottom,x1,x4);
line(right,bottom,x3,x4);
}

plz try to include a explanation

Recommended Answers

All 7 Replies

what os and compiler ??? Looks like TurboC code, but can't be sure.

Ya I too feel this is TC that you are working on.So I would suggest this...

1) You can always play with the co-ordinates when working on TC, like usage of gotoxy( x , y ) To move to a particular part of the screen and then print the stuff you want by using settextcolor() (I am not sure if this is the command just type "textcolor" and put your cursor there and press Cntrl F1 you'll get help).

2) Another thing I would like to suggest here is usage of "viewport" concept here so that you can clear and modify only a part of the screen rather than redrawing the whole screen.

ancient dragon:it's TC (c++)

csurfer :i retried gotoxy(x,y) it didnt work properly and outtextxy is tough to control


i am looking for a function if possible

and i cannt understand the concept of view port


csurfer :i retried gotoxy(x,y) it didnt work properly

The problem is not gotoxy() -- the problem is your code;

i am looking for a function if possible

There isn't one -- you have to write it yourself.

wow i am just amazed how much a retired programmer can inspire a newbie programmer ancient dragon i hope i dont get such kinda inspirations

k if anybody has some clues or hints plz do post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.