/*--------本程序由sunny整理完成-----------*/
*** 基于DOS平台,在Turbo c2.0中调试通过 **
*** 原码见于http://sunny1979.icpcn.com ***/
#include "conio.h"
#include "stdio.h"
#include "graphics.h"
#include "stdlib.h"
#include "dos.h"
void Box(int left,int top,int right,int bottom,int color)
{
int old_color;
old_color=getcolor();
setcolor(color);
line(left,top,right,top);
line(left,top,left,bottom);
line(right,top,right,bottom);
line(left,bottom,right,bottom);
setcolor(old_color);
}
Dbox(int left,int top,int right,int bottom)
{
int x;
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(left,top,right,bottom);
setcolor(BLACK);
Box(left,top,right,bottom,BLACK);
setfillstyle(SOLID_FILL,3);
bar(left+2,top+2,right-2,bottom-2);
setcolor(BLACK);
line(left,top+16+49,right,top+16+49);
setcolor(LIGHTGRAY);
line(left+3,top+16+50,right-3,top+16+50);
setfillstyle(SOLID_FILL,BLUE);
bar(left+2,top+3,right-3,top+16+47);
}
Dbox1(int left,int top,int right,int bottom)
{
int x;
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(left,top,right,bottom);
setcolor(BLACK);
Box(left,top,right,bottom,BLACK);
setfillstyle(SOLID_FILL,7);
bar(left+2,top+2,right-2,bottom-2);
}
Button(int left,int top,int length,int b,int c1,int c2,int c3,int g) /*c1=white--black; c2=black--darkgray;c3=darkgray---white */
{
int bottom,right;
bottom=top+b;
right=left+length;
setfillstyle(SOLID_FILL,c1);
bar(left,top,right,bottom);
setcolor(BLACK);
Box(left,top,right,bottom,c2);
setfillstyle(SOLID_FILL,g);
bar(left+2,top+2,right-1,bottom-1);
setcolor(c3);
setlinestyle(0,0,1);
line(left+1,bottom-1,right,bottom-1);
line(right-1,top+1,right-1,bottom);
}
Buttont(int left,int top,int length,int b,int g)
{
int bottom,right;
bottom=top+b;
right=left+length;
setfillstyle(SOLID_FILL,BLACK);
bar(left,top,right,bottom);
setcolor(BLACK);
Box(left,top,right,bottom,DARKGRAY);
setfillstyle(SOLID_FILL,g);
bar(left+3,top+3,right-1,bottom-1);
setcolor(WH99vE);
setlinestyle(0,0,1);
line(left+1,bottom-1,right-1,bottom-1);
line(right-1,top+1,right-1,bottom-1);
}
main()
{
int GD=DETECT,GM;
initgraph(&GD,&GM,"");
setbkcolor(1);
textcolor(1);
Button(100,100,50,20,15,0,8,7);
getch();
closegraph();
clrscr();
exit(0);
}