用C语言实现按钮新技术
ButtonDefine(but6,400+5*dis,200,450+5*dis,250);
ButtonDefine(but7,450+6*dis,200,500+6*dis,250);
while(ch!=27)
{
switch(ch) }
case'1':
ReleaseButton(but1);break;
case'2':
ReleaseButton(but2);break;
case'3':
ReleaseButton(but3);break;
case'4':
ReleaseButton(but4);break;
case'5':
ReleaseButton(but5);break;
case'6':
ReleaseButton(but6);break;
case'7':
ReleaseButton(but7);break;
}
ch=getch();
if(ch==27)
break;
switch(ch)
{
case'1':
P
case'2':
PutDownButton(but2);break;
case'3':
PutDownButton(but3);break;
case'4':
PutDownButton(but4);break;
case'5':
PutDownButton(but5);break;
case'6':
PutDownButton(but6);break;
case'7':
PutDownButton(but7);break;
}
delay-time(delay);
}
closegraph():
return 0;
}
void ButtonDefine(button *bt.short x1,short y1,short x2,short y2)
{
START-X=x1;
START-Y=y1;
END-X=x2;
END-Y=y2;
}
void ReleaseButton(button *bt)
{
int i,j;
setcolor(7);
setfillstyle(1,7);
bar(START-X,START-Y,END-X,END-Y);
setcolor(Button White);
setfillstyle(1,7);
bar(START-X+Grap,START-Y+Grap,END-X-Grap,END-Y-Grap);
setcolor(15);
for(j=0;j<=Grap;j++)
{
line(START-X,j+START-Y,END-X-j,j+STAT-Y);
}
for(i=0,i<=Grap;j++)
{
line(START-X+i,START-Y+Grap,START-X+i,END-Y-i);
}
setcolor(ButtonBlack);
for(j=0;j<Grap;j++)
}
line(END-X,j+END-Y-Grap,START-X+Grap-j,j+END-Y-Grap);
}
for(i=0,i<Grap;i++)
{
line(i+END-X+Grap,END-Y-Grap,i+END+X-Grap,START-Y+Grap-i);
}
return;
}
void PutDownButton(button *bt)
}
int i,j;
setcolor(put-color);
setfillstyle(1,put-color);
bar(START-X+Grap,START-Y+Grap,END-X-Grap,END-Y-Grap);
setcolor(ButtonBlack);
for(j=0;j<=Grap;j++)
{
line(START-X,j+START-Y,END-X-j,j+START-Y);
;}
for (i=0;i<Garp;i++)
{
line (START-X+i,START-Y+Grap,START-X+i,END-Y-i);
setcolor(15);
for(j=0,j<=Grap;j++)
{
line(END-X,j+END-Y-Grap,START-X+Grap-j,j+END-Y-Grap);
}
for(i=0;i<=Grap;i++)
{
line(i+END-X-Grap,END-Y-Grap,i+END-X-Grap,START-Y+Grap-i);
}
}
void delay-time(long int i)
{
i=0;
while(i<=delay)
i++;
}
button.h
typedef struct ButtonDef
{ short x1;
short y1;
short x2;
short y2;
}button;
《用C语言实现按钮新技术(第2页)》
本文链接地址:http://www.oyaya.net/fanwen/view/171965.html
ButtonDefine(but7,450+6*dis,200,500+6*dis,250);
while(ch!=27)
{
switch(ch) }
case'1':
ReleaseButton(but1);break;
case'2':
ReleaseButton(but2);break;
case'3':
ReleaseButton(but3);break;
case'4':
ReleaseButton(but4);break;
case'5':
ReleaseButton(but5);break;
case'6':
ReleaseButton(but6);break;
case'7':
ReleaseButton(but7);break;
}
ch=getch();
if(ch==27)
break;
switch(ch)
{
case'1':
P
utDownButton(but1);break;
case'2':
PutDownButton(but2);break;
case'3':
PutDownButton(but3);break;
case'4':
PutDownButton(but4);break;
case'5':
PutDownButton(but5);break;
case'6':
PutDownButton(but6);break;
case'7':
PutDownButton(but7);break;
}
delay-time(delay);
}
closegraph():
return 0;
}
void ButtonDefine(button *bt.short x1,short y1,short x2,short y2)
{
START-X=x1;
START-Y=y1;
END-X=x2;
END-Y=y2;
}
void ReleaseButton(button *bt)
{
int i,j;
setcolor(7);
setfillstyle(1,7);
bar(START-X,START-Y,END-X,END-Y);
setcolor(Button White);
setfillstyle(1,7);
bar(START-X+Grap,START-Y+Grap,END-X-Grap,END-Y-Grap);
setcolor(15);
for(j=0;j<=Grap;j++)
{
line(START-X,j+START-Y,END-X-j,j+STAT-Y);
}
for(i=0,i<=Grap;j++)
{
line(START-X+i,START-Y+Grap,START-X+i,END-Y-i);
}
setcolor(ButtonBlack);
for(j=0;j<Grap;j++)
}
line(END-X,j+END-Y-Grap,START-X+Grap-j,j+END-Y-Grap);
}
for(i=0,i<Grap;i++)
{
line(i+END-X+Grap,END-Y-Grap,i+END+X-Grap,START-Y+Grap-i);
}
return;
}
void PutDownButton(button *bt)
}
int i,j;
setcolor(put-color);
setfillstyle(1,put-color);
bar(START-X+Grap,START-Y+Grap,END-X-Grap,END-Y-Grap);
setcolor(ButtonBlack);
for(j=0;j<=Grap;j++)
{
line(START-X,j+START-Y,END-X-j,j+START-Y);
;}
for (i=0;i<Garp;i++)
{
line (START-X+i,START-Y+Grap,START-X+i,END-Y-i);
setcolor(15);
for(j=0,j<=Grap;j++)
{
line(END-X,j+END-Y-Grap,START-X+Grap-j,j+END-Y-Grap);
}
for(i=0;i<=Grap;i++)
{
line(i+END-X-Grap,END-Y-Grap,i+END-X-Grap,START-Y+Grap-i);
}
}
void delay-time(long int i)
{
i=0;
while(i<=delay)
i++;
}
button.h
typedef struct ButtonDef
{ short x1;
short y1;
short x2;
short y2;
}button;
《用C语言实现按钮新技术(第2页)》