为TurboC增加一个立体按钮函数
/*在主程序中调用举例*/
#include "graphics.h"
void windows(int x,int y,int xa,int ya,int high,int stat,int color);
main()
{
int d=VGA,m=VGAHI;
initgraph(&d,&m,"");
windows(100,100,200,130,4,0,1);
getch();
closegraph();}
/*立体按钮函数*/
void windows(int x,int y,int xa,int ya,int high,int stat,int color)
{register i;
if(!stat)
setfillstyle(1,color+8);else setfillstyle(1,color);
bar(x,y,xa,ya);
setcolor(0);
rectangle(x-high,y-high,xa+high,ya+high);
rectangle(x,y,xa,ya);
if(stat)
setcolor(7);else setcolor(8);
for (i=1;i<high;i++)
{line(x-i,y-i,x-i,ya+i);}
line(x-i,ya+i,xa+i,ya+i);}
if(stat)
setcolor(8);else setcolor(7);
for(i=1;i<high;i++)
{line(xa+i,y-i,xa+i,ya+i);
line(x-i,y-i,xa+i,y-i);}
setcolor(0);
line(x-high,y-high,x,y);
line(xa+high,y-high,xa,y);
line(xa+high,ya+high,xa,ya);
line(x-high,ya+high,x,ya);
}