C语言西文下拉菜单的设计

完成一个类似TC集成系统菜单的西文下拉菜单的设计,支持鼠标,不要求实现实现个子菜单的功能,界面仿turboc2.0系统菜单

我做了一个,可是你一分也不给我,我很郁闷啦.
#include"stdio.h"
#include"stdlib.h"
#include"dos.h"
#include"conio.h"
#include"bios.h"
#define DOWN 0x5000
#define UP 0x4800
#define Esc 0x011b
#define ENTER 0x1c0d
#define Backspace 0xe08
#define ALT_B 12288 /*组合键alt+b*/
int key;
int textx,texty;
char save[4096];
char c[4096];
struct menustruct
{
char name[40];
char str[11][20];
int n;
}m1[1];
int i,j;
void menu()
{
system("cls");
textbackground(BLUE);
window(1,1,25,80);
clrscr();
textx=3;
texty=2;
gotoxy(1,2);
printf("%c",218);
for(i=0;i<78;i++)
printf("%c",196);
printf("%c",191);
for(i=3;i<=23;i++)
{
gotoxy(1,i);
printf("%c",179);
gotoxy(80,i);
printf("%c",179);
}
printf("%c",192);
for(i=0;i<78;i++)
printf("%c",196);
printf("%c",217);
gotoxy(1,1);
textcolor(7);
for(i=0;i<80;i++)
cprintf("%c",219);
selectitem();
drawselectitem();
gettext(2,3,78,23,c);
}
selectitem()
{
strcpy(m1[0].name,"*************menu*************");
strcpy(m1[0].str[0]," intput ");
strcpy(m1[0].str[1]," consult ");
strcpy(m1[0].str[2]," output ");
strcpy(m1[0].str[3]," modify ");
strcpy(m1[0].str[4]," delete ");
strcpy(m1[0].str[5]," recover ");
strcpy(m1[0].str[6]," add ");
strcpy(m1[0].str[7]," save ");
strcpy(m1[0].str[8]," open ");
strcpy(m1[0].str[9]," tong ji ");
strcpy(m1[0].str[10]," exit ");
m1[0].n=11;
}
drawselectitem()
{
for(i=0;i<3;i++)
RedText(i,1,m1[i].name);
}
RedText(int x,int y,char *z)
{
textbackground(7);
gotoxy(3+x*20,y);
for(j=0;z[j];j++)
{
if(j==0)
textcolor(RED);
else
textcolor(BLACK);
cprintf("%c",z[j]);
}
}
BlackText(int x,int y,char *z)
{
textbackground(0);
textcolor(15);
gotoxy(3+20*x,y);
cputs(z);
}
Run()
{
while(1)
{
gotoxy(textx,texty);
key=bioskey(0);
switch(key)
{
case ALT_B:
case Esc:DrawM1(0);break;
case UP:
{
if(textx==3)
textx=23;
textx--;
gotoxy(texty,textx);
}break;
case DOWN:
{
if(textx==23)
textx=3;
textx++;
gotoxy(texty,textx);
}break;
case Backspace:
{
if(texty==2&&textx==3)
continue;
else
{
if(texty!=2)texty--;
else
if(texty==2)
{
texty=78;
textx--;
}
gotoxy(texty,textx);
printf(" ");
gotoxy(texty,textx);
}
}break;
case ENTER:
{
if(textx==23)
continue;
textx++;
texty=2;
gotoxy(texty,textx);
}break;
default:
{
if(texty==79&&textx==23)
continue;
else
if(texty==79&&textx!=23)
{
textx++;
texty=2;
}
gotoxy(texty,textx);
printf("%c",key);
if(texty==79)
continue;
else
texty++;
}
}
}
}
DrawFrame(int l,int u,int r,int d,int tcolor,int bcolor)
{
textbackground(bcolor);
textcolor(bcolor);
for(i=1;i<=r;i++)
{
for(j=u;j<=d;j++)
{
gotoxy(i,j);
printf("%c",219);
}
}
textcolor(tcolor);
for(i=u+1;i<d;i++)
{
gotoxy(1,i);
cprintf("%c",179);
gotoxy(r,i);
cprintf("%c",179);
}
for(i=l+1;i<r;i++)
{
gotoxy(i,u);
cprintf("%c",196);
gotoxy(i,d);
cprintf("%c",196);
}
gotoxy(l,u);
cprintf("%c",218);
gotoxy(r,u);
cprintf("%c",191);
gotoxy(l,d);
cprintf("%c",192);
gotoxy(r,d);
cprintf("%c",217);
}
DrawM1(int n)
{
gettext(1,1,80,25,save);
BlackText(n,1,m1[n].name);
DrawFrame(3+20*n-1,2,3+20*n+19,3+m1[n].n,0,7);
for(i=3;i<3+m1[n].n;i++)
{
if(i==3)
BlackText(n,i,m1[n].str[i-3]);
else
RedText(n,i,m1[n].str[i-3]);
}
gotoxy(79,1);
MoveM1(n,3);
}
MoveM1(int n,int x)
{
int flag=1;
while(flag)
{
gotoxy(79,1);
key=bioskey(0);
gotoxy(79,1);
switch(key)
{
case Esc:
puttext(1,1,80,25,save);
flag=0;
break;
case UP:
RedText(n,x,m1[n].str[x-3]);
if(x==3)
x=3+m1[n].n-1;
else
x--;
BlackText(n,x,m1[n].str[x-3]);
flag=1;
break;
case DOWN:
RedText(n,x,m1[n].str[x-3]);
if(x==(3+m1[n].n-1))
x=3;
else
x++;
BlackText(n,x,m1[n].str[x-3]);
flag=1;
break;
case ENTER:
puttext(1,1,80,25,save);
Enter(n);
flag=0;
break;
}
gotoxy(79,1);
}
}
Enter(int m)
{
switch(m)
{
case 0:printf(" student input");break;
case 1:printf(" student consult ");break;
case 2:printf(" student output ");break;
case 3:printf(" student modify ");break;
case 4:printf(" student delete ");break;
case 5:printf(" student recover");break;
case 6:printf(" student add");break;
case 7:printf(" student save ");break;
case 8:printf(" student open ");break;
case 9:printf(" student tong ji");break;
case 10:printf(" student exit");exit(0);
}
}
main()
{
menu();
Run();
}


温馨提示:答案为网友推荐,仅供参考