添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
#include #define textsml settextstyle(20, 0, "微软雅黑", 0, 0, 400, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0) #define textmid settextstyle(23, 0, "微软雅黑", 0, 0, 600, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0) #define textlrg settextstyle(27, 0, "微软雅黑", 0, 0, 600, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0) #define textElrg settextstyle(35, 0, "微软雅黑", 0, 0, 700, 0, 0, 0, 0, 0, 0, ANTIALIASED_QUALITY, 0) #define Checkpos checkpos(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, msg.x, msg.y) struct buttonbox { int lx, ly, rx, ry; int ava=false; }butt[1000]; struct MusicInfo { char Title[100], Album[100], Author[50]; int AlbumNum, LibNum; char menu[6][20] = { "曲目查询","曲目浏览","曲目操作","使用指南","关于本程序" }; int step = 45, ButtNum, ClickFlag = -1; void home(); void Click(int num); int checkpos(int lx, int ly, int rx, int ry, int nowx, int nowy) { if (nowx >= lx && nowy >= ly && nowx <= rx && nowy <= ry) return true; else return false; void SetButton(int lx, int ly, int rx, int ry, int num,int r,int g,int b) { textmid; setfillcolor(RGB(r,g,b)); solidroundrect(lx, ly, rx, ry, 15, 15); setbkmode(TRANSPARENT); int ty = (ly + ly + (ry-ly) - textheight(menu[num])) / 2; outtextxy(lx+10, ty, menu[num]); return; void ButtonOperationClick(int lx, int ly, int rx, int ry, int i, ExMessage msg) { int tmp = true; //button-click-effect setfillcolor(RGB(47, 41, 41)); solidroundrect(310, 15, 1014, 750, 15, 15); //check lb status while(1) { if (!msg.lbutton) { Click(i); break; peekmessage(&msg, EM_MOUSE); return; void ButtonOperationGen2() { //initialize data ExMessage msg; int OperationFlag = 0; int lx, ly, rx, ry; while (1) { //check which button is the mouse on for (int i = 0; i <= ButtNum; i++) { if (butt[i].ava == false) continue; lx = butt[i].lx, ly = butt[i].ly, rx = butt[i].rx, ry = butt[i].ry; //get check-messages peekmessage(&msg, EM_MOUSE); OperationFlag = Checkpos; //check hover on button_i if (OperationFlag) { //button-hover-effect SetButton(lx, ly, rx, ry, i, 50, 50, 50); //check hover on button_i //check click if (msg.lbutton) { SetButton(lx, ly, rx, ry, i, 196, 43, 28); //ButtonOperationClick(lx, ly, rx, ry, i, msg); //button-click-effect setfillcolor(RGB(43, 43, 45)); solidroundrect(310, 15, 1014, 750, 15, 15); //check lb status while (1) { if (!msg.lbutton) { Click(i); break; peekmessage(&msg, EM_MOUSE); break; //renew check-messages peekmessage(&msg, EM_MOUSE); OperationFlag = Checkpos; } while (OperationFlag); //button-default-effect SetButton(lx, ly, rx, ry, i, 43, 43, 45); int main() { home(); return 0; void home() { initgraph(1024,768,EW_NOMINIMIZE); setbkcolor(RGB(36, 30, 30)); cleardevice(); setfillcolor(RGB(43, 43, 45)); solidroundrect(10, 15, 300, 750, 20, 20); solidroundrect(310, 15, 1014, 750, 20, 20); //account 10,25,370,125 setfillcolor(RGB(149, 229, 149)); solidcircle(66, 66, 36);//startx = 30 setbkmode(TRANSPARENT); textlrg; outtextxy(120, 45, "曲库后台"); textsml; outtextxy(120, 70, "[email protected]"); Click(3); //menu-function classify textmid; for (ButtNum = 0; ButtNum <= 4; ButtNum++) { butt[ButtNum].ava = true; butt[ButtNum].lx = 30; butt[ButtNum].ly = 130 + step * ButtNum; butt[ButtNum].rx = butt[ButtNum].lx + 250; butt[ButtNum].ry = butt[ButtNum].ly + 40; SetButton(butt[ButtNum].lx, butt[ButtNum].ly, butt[ButtNum].rx, butt[ButtNum].ry, ButtNum, 43, 43, 45); //button operation ButtonOperationGen2(); return; void Click(int num) { switch (num) case 0: { textElrg; outtextxy(360, 60, menu[num]); return; case 1: { textElrg; outtextxy(360, 60, menu[num]); return; case 2: { textElrg; outtextxy(360, 60, menu[num]); return; case 3: { int txts = 130; textElrg; outtextxy(360, 60, menu[num]); textmid; outtextxy(400, txts, "本程序使用鼠标和键盘操作"); outtextxy(400, txts += 65, "使用鼠标点击左侧菜单栏中的对应按钮,可进入功能界面"); outtextxy(400, txts += 35, "在功能界面使用鼠标点击需要的功能按钮"); outtextxy(400, txts += 35, "根据提示点击按钮或者在对话框中输入需要的信息"); outtextxy(400, txts += 65, "信息录入结束后点击 -更新信息文件- 即可更新信息并支持查询"); outtextxy(400, txts += 65, "对于硬件配置较差或运行环境不完备的用户"); outtextxy(400, txts += 35, "我们提供了控制台操作界面的版本"); outtextxy(400, txts += 65, "祝愿您使用愉快"); return; case 4: { int txts = 130; textElrg; outtextxy(360, 60, menu[num]); textmid; outtextxy(400, txts, "此程序是2021级C语言课程设计展示用程序"); outtextxy(400, txts += 55, "制作人为:"); outtextxy(400, txts += 55, "此程序的主要功能有:"); textsml; outtextxy(400 + 20, txts += 35, "歌曲信息录入、修改、删除功能"); outtextxy(400 + 20, txts += 35, "歌曲排序浏览功能"); outtextxy(400 + 20, txts += 35, "按歌名查询、按演唱者查询等功能"); textmid; outtextxy(400, txts += 55, "队员的主要分工如下:"); textsml; outtextxy(400 + 20, txts += 35, ":歌曲信息录入、修改、删除功能"); outtextxy(400 + 20, txts += 35, ":文件读取与写入操作,及主函数"); outtextxy(400 + 20, txts += 35, ":歌曲信息排序、浏览、查询功能"); return; default: break; return; //bad attempt void ButtonOperation() { ExMessage msg; int HoverFlag = false;//avoid over-refreshing when hovering int PressFlag = false;//avoid over-refreshing when pressing int ClickNum = -1; while (1) { int i; for (i = 0; i <= ButtNum; i++) { peekmessage(&msg, EM_MOUSE); //hover-effect if (checkpos(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, msg.x, msg.y) && HoverFlag == false) { SetButton(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, i, 50, 50, 50); HoverFlag = true; //if mouse is still on while (1) { peekmessage(&msg, EM_MOUSE); //cancel hover-effect if (checkpos(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, msg.x, msg.y) == false) { SetButton(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, i, 47, 41, 41); HoverFlag = false; break; //click effect if (msg.lbutton) { PressFlag = true; ClickNum = i; SetButton(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, i, 232, 17, 35); //if lb is still down while (1) { setfillcolor(RGB(47, 41, 41)); solidroundrect(310, 15, 1014, 750, 15, 15); peekmessage(&msg, EM_MOUSE); if (!checkpos(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, msg.x, msg.y) && HoverFlag) { PressFlag = false; HoverFlag = false; SetButton(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, i, 50, 50, 50); if (msg.lbutton == 0) { PressFlag = false; if (ClickNum == i) { break; SetButton(butt[i].lx, butt[i].ly, butt[i].rx, butt[i].ry, i, 50, 50, 50); break; }//if lb is still down Click(i); }//click effect }//if mouse is still on }//hover-effect Sleep(20); return;