⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 界面.c

📁 学生成绩管理系统。运行后
💻 C
字号:
#include<dos.h>
#include<bios.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define DOWN 0x5000
#define UP 0x4800
#define SPACE 0x3920
#define Esc 0x11b
#define ENTER 0x1c0d
#define Backspace 0xe08
#define ALT_B 12288
#define ALT_M 12800
#define ALT_H 8960




struct menustruct
{
	char name[10];
	char str[10][20];
	int n;
}menu1[3];
int key;
int textx,texty;
char c[4096];
char save[4096];
int i,j;



void Menu();
void Selectitem();
void DrawSelectitem();
void RedText(int x,int y,char*z);
void BlackText(int x,int y,char*z);
void Run();
void DrawM1(int n);
void MoveM1(int n,int x);
void Enter(int m,int n);



void main()
{
	Menu();
	Run();
}


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);
}



Void Selectitem()
{
	strcpy(menu1[0].name,"Book     ");
	strcpy(menu1[0].str[0],"Add     ");
	strcpy(menu1[0].str[1],"Consult     ");
	strcpy(menu1[0].str[2],"Del     ");
	strcpy(menu1[0].str[3],"Borrow    ");
	strcpy(menu1[0].str[4],"Return    ");
	strcpy(menu1[0].str[5],"Exit    ");
	menu1[0].n=6;
	strcpy(menu1[1].name,"Member");
	strcpy(menu1[1].str[0],"Add    ");
	strcpy(menu1[1].str[1],"Consult    ");
	strcpy(menu1[1].str[2],"Del    ");
	strcpy(menu1[1].str[3],"Member&Book");
	menu1[1].n=4;
	strcpy(menu1[2].mane,"Help");
	strcpy(menu1[2].str[0],"This System");
	strcpy(menu1[2].str[1],"Version");
	menu1[2].n=2;
}



void DrawSelectitem()
{
	for(i=0;i<3;i++)
		RedText(i,1,menu1[i].name);
}


void 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]);
	}
}




void BlackText(int x,int y,char*z)
{
	textbackground(2);
	textcolor(15);
	gotoxy(3+20*x,y);
	cputs(z);
}


void Run()
{
	while(1)
	{
		gotoxy(texty,textx);
		key=bioskey(0);
		switch(key)
		{
		case ALT_B:
		case Esc:  DrawM1(0);break;
		case ALT_M:DrawM1(1);break;
		case ALT_H:DrawM1(2);break;
		case UP:if(textx==3)textx=23;
			textx--;
			gotoxy(texty,textx);
			break;
		case LEFT:if(texty==2)texty=79;
			texty--;
			gotoxy(texty,textx);
			break;
		case DOWN:if(textx==23)textx=3;
			textx++;
			gotoxy(texty,textx);
			break;
		case RIGHT:if(texty==79)texty=2;
			texty++;
			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(" ");
			goto(textx,texty);
			break;
		case SPACE:if(texty==79)continue;
			else
			{
				gotoxy(texty,textx);
				printf(" ");
				texty++;
				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++;
			break;
		}
	}
}



void DrawFrame(int 1,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(1,d);
	cprintf("%c",192);
	gotoxy(r,d);
	cprintf("%c",217);
}



void DrawM1(int n)
{
	gettext(1,1,80,25,save);
	BlackText(n,1,menu1[n].name);
	DrawFrame(3+20*n-1,2,3+20*n+19,3+menu1[n].n,0,7);
	for(i=3;i<3+menu1[n],n;i++)
	{
		if(i==3)
			BlackText(n,i,menu1[n].str[i-3]);
		else 
			RedText(n,i,menu1[n].str[i-3]);
	}
	gotoxy(79,1);
	MoveM1(n,3);
}


void 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 LEFT:puttext(1,1,80,25,save);
			if(n==0)DrawM1(2);
			else DrawM1(n-1);
			flag=0;
			break;
		case RIGHT:puttext(1,1,80,25,save);
			if(n==2)DrawM1(0);
			else DrawM1(n+1);
			flag=0;
			break;
		case UP:RedText(n,x,menu1[n].str[x-3]);
			if(x==3)
				x=3+menu1[n].n-1;
			else x--;
			BlackText(n,x,menu1[n].str[x-3];
			flag=1;
			break;
		case DOWN:RedText(n,x,menu1[n].str[x-3]);
			if(x==3+menu1[n].n-1)
				x=3;
			else x++;
			BlackText(n,x,menu1[n].str[x-3]);
			flag=1;
			break;
		case ENTER:puttext(1,1,80,25,save);
			Enter(n,x-3);
			flag=0;
			break;
		}
		gotoxy(79,1);
	}
}


void Enter(int m,int n)
{
	switch(m)
	{
case0:switch(n)
	  {
case 0://BookAdd();break;
case 1://BookConsult();break;
case 2://BookDel();break;
case 3://BookBorrow();break;
case 4://BookReturn();break;
case 5:exit(0);
	  }
	  break;
	case 1:switch(n)
		   {
	case 0://MemberAdd();break;
	case 1://MemberSearch();break;
	case 2://MemberDel();break;
	case 3:break;
		   }
		break;
	case 2:switch(n)
		   {
	case 0://Help();break;
	case 1://Version();break;
		   }
		break;
	}
}
		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -