C语言中实现按钮.docx

上传人:小飞机 文档编号:3155222 上传时间:2023-03-11 格式:DOCX 页数:8 大小:37.08KB
返回 下载 相关 举报
C语言中实现按钮.docx_第1页
第1页 / 共8页
C语言中实现按钮.docx_第2页
第2页 / 共8页
C语言中实现按钮.docx_第3页
第3页 / 共8页
C语言中实现按钮.docx_第4页
第4页 / 共8页
C语言中实现按钮.docx_第5页
第5页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《C语言中实现按钮.docx》由会员分享,可在线阅读,更多相关《C语言中实现按钮.docx(8页珍藏版)》请在三一办公上搜索。

1、C语言中实现按钮#include<graphics.h>#include<conio.h>#include<alloc.h>#include<stdio.h>#include<process.h>#includebutton.h#defineSTART-Xbt->x1#defineSTART-Ybt->y1#defineEND-Xbt->x2#defineEND-Ybt->y2#defineGrap1#defileScreenBkColor2#definerelease-color7#defineput-color3#defineButt

2、onWhite0x0f#defineButtonBlack0x00#definedelay50000#definedis10voidButtonDefine(button*bt.shout.short.short.short);voidReleaseButto n(button*bt);voidPutDownButton(button*bt);voiddelay-time(longint);mainintgdriver=DETECT.gmode=VGAHI:button*but,*but1.*but2.*bt,*but3,*but4,*but5,*but6,*but7;intch;initgr

3、aph(&gdriver,&gmode,d:tc);setcolor(ScreenBkColor);setbkcolor(2);clrscr;ButtonDefine(but,50,50,600,400);putDownButton(but);ButtonDefine(but1,150,200,200,250); ButtonDefine(but2,200+dis,200,250+dis,250);ButtonDefine(but3,250+2*dis,200,300+2*dis,250);ButtonDefine(but4,300+3*dis,200,350+3*dis,250);Butto

4、nDefine(but5,350+4*dis,200,400+4*dis,250);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)case1:ReleaseButton(but1);break;case2:ReleaseButton(but2);break;case3:ReleaseButton(but3);break;case4:ReleaseButton(but4);break;case5:Release

5、Button(but5);break;case6:ReleaseButton(but6);break;case7:ReleaseButton(but7);break;ch=getch;if(ch=27)break;switch(ch)case1:PutDownButton(but1);break;case2:PutDownButton(but2);break;case3:PutDownButton(but3);break;case4:PutDownButton(but4);break;case5:PutDownButton(but5);break;case6:PutDownButton(but

6、6);break;case7:PutDownButton(but7);break;delay-time(delay);closegraph:return0;voidButtonDefine(button*bt.shortx1,shorty1,shortx2,shorty2)START-X=x1;START-Y=y1;END-X=x2;END-Y=y2;voidReleaseButton(button*bt)inti,j;setcolor(7);setfillstyle(1,7);bar(START-X,START-Y,END-X,END-Y);setcolor(ButtonWhite);set

7、fillstyle(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-

8、Grap);for(i=0,i<Grap;i+)line(i+END-X+Grap,END-Y-Grap,i+END+X-Grap,STAR T-Y+Grap-i);return;voidPutDownButton(button*bt)inti,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,

9、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);voiddelay-time(longinti)i=0;while(i<=delay)i+;button.htypedefstructButtonDefshortx1;shorty1;shortx2;shorty2;button;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号