VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time ]
Subject: Button in C Language


Author:
Zahid Iqbal
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 10:18:10 06/19/05 Sun
Author Host/IP: NoHost/202.174.136.205

#include
#include
#include
#include
#include
void drawButton(int x,int y,int width, int height, char caption[],int status);
//======================================================================
//Made by Zahid iqbal Shah BIT Qta
void main(void)
{
int dr=DETECT,md;
initgraph(&dr,&md,"c:\\tc\\bgi");
setbkcolor(3);

while(!kbhit())
{
drawButton(100,100,160,20,"CANCEL",0);
drawButton(100,300,160,120,"1",0);
delay(500);
drawButton(100,100,160,20,"CANCEL",1);
drawButton(100,300,160,120,"1",1);
delay(500);
}

getch();
closegraph();

}
//=====================================================================
void drawButton(int x,int y,int width, int height, char caption[],int status)
{

setfillstyle(1,7);
bar(x,y,x+width,y+height);

if(status==0)
setcolor(15);
else
setcolor(8);

line(x,y,x+width,y);
line(x,y,x,y+height);

if(status==0)
{
setcolor(8);
line(x+1,y+height,x+width,y+height);
line(x+width,y+1,x+width,y+height);
}

setcolor(8);

if(status==0)
outtextxy(x+width/2-(strlen(caption)*3.5), y+height/2-3,caption);
else
outtextxy(x+width/2-(strlen(caption)*3.5)+2, y+height/2-3+1,caption);

}

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.