文本模式下的GUI设计,使用tc2.0 (2)
2008-03-08 12:49:39 来源:WEB开发网核心提示:/*对该站的建议:希望下载能够开放些,真的很想要那些东东啊!可我现在还不是高级会员,文本模式下的GUI设计,使用tc2.0 (2),5~~5*/#include "conio.h"#include "stdio.h"#include "stdlib.h"#in
/*对该站的建议:希望下载能够开放些,真的很想要那些东东啊!可我现在还不是高级会员。5~~5~~~~*/
#include "conio.h"
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "dos.h"
#include "bios.h" #define F1 0x3b00
#define F2 0x3c00
#define F3 0x3d00
#define F4 0x3e00
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define DOWN 0x5000
#define UP 0x4800
#define SPACE 0x3920
#define ESC 0x011b
#define ENTER 0x1c0d int CurX=2,CurY=4;
static char MenuName1[10]="File";
static char MenuName3[12]="Option";
static char MenuName2[14]="fUnction";
static char MenuName4[10]="Help";
static char OptionMenu1[3][7]={"O1Mnu1",
"O2Mnu1",
"O3Mnu1"
};
static char OptionMenu2[3][9]={" O1Mnu2 ",
" O2Mnu2 ",
" O3Mnu2 "
};
static char OptionMenu3[3][9]={" O1Mnu3 ",
" O2Mnu3 ",
" O3Mnu3 "
};
static char OptionMenu4[3][9]={" O1Mnu4 ",
" O2Mnu4 ",
" O3Mnu4 "
};
int getkey(int *key)/*显示时间函数*/
{strUCt time aa;
int a,b;
char time[20];
gettime(&aa);/*获取时间*/
a=aa.ti_sec;
while(!kbhit())
{
gettime(&aa);
b=aa.ti_sec;
if(abs(b-a)>=1)
{
a=b;
sPRintf(time,"%02d:%02d:%02d",aa.ti_hour,aa.ti_min,aa.ti_sec);
gotoxy(70,25);
textbackground(0);
textcolor(YELLOW);
cputs(time);
gotoxy(CurX,CurY); /* else cur stin on the right of time */
}
}
*key=bioskey(0);
}
DisplayMenu(int PosMenu,int PosOption)
{
int VarX,VarY,Var;
switch(PosMenu)
{
case 1:{
gotoxy(7,1);
textcolor(WH99vE);
textbackground(BLACK); /*显示菜单1的名字,其背景色相对初始界面改变*/
cprintf("%s",MenuName1);
textcolor(BLACK);textbackground(7);
for(VarX=7;VarX<=13;VarX++)
{gotoxy(VarX,2); /*menu1box画上边框*/
cprintf("%c",196);
gotoxy(VarX,6);
cprintf("%c",196); /*menu1box画下边框*/
}
for(VarY=3;VarY<=5;VarY++)
{gotoxy(6,VarY);
cprintf("%c",179);
gotoxy(14,VarY);
cprintf("%c",179);
}
gotoxy(14,6);
cprintf("%c",217); /*右下角*/
gotoxy(6,2);
cprintf("%c",218);/*左上角*/
gotoxy(6,6);
cprintf("%c",192);/*左下角*/
gotoxy(14,2);
cprintf("%c",191);/*右上角*/
/***显示各个菜单1的项目***/
for(Var=0;Var<3;Var++)
{gotoxy(6+2,2+Var+1);
cprintf("%s",&OptionMenu1[Var][0]);
}
/***显示菜单1选中选项的内容***/
gotoxy(6+1,2+PosOption);
textbackground(BLACK);
textcolor(WH99vE);
cprintf("%s",&OptionMenu1[PosOption-1][0]);
gotoxy(CurX,CurY);
break;
}
case 2:{
gotoxy(27,1);
textcolor(WH99vE);
textbackground(BLACK); /*显示菜单2的名字,其背景色相对初始界面改变*/
cprintf("%s",MenuName2);
textcolor(BLACK);textbackground(7);
for(VarX=27;VarX<=34;VarX++)
{gotoxy(VarX,2); /*menu1box画上边框*/
cprintf("%c",196);
gotoxy(VarX,6);
cprintf("%c",196); /*menu1box画下边框*/
}
for(VarY=2;VarY<=5;VarY++)
{gotoxy(26,VarY);
cprintf("%c",179);
gotoxy(35,VarY);
cprintf("%c",179);
}
gotoxy(35,6);
cprintf("%c",217); /*右下角*/
gotoxy(26,2);
&nb
#include "conio.h"
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "dos.h"
#include "bios.h" #define F1 0x3b00
#define F2 0x3c00
#define F3 0x3d00
#define F4 0x3e00
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define DOWN 0x5000
#define UP 0x4800
#define SPACE 0x3920
#define ESC 0x011b
#define ENTER 0x1c0d int CurX=2,CurY=4;
static char MenuName1[10]="File";
static char MenuName3[12]="Option";
static char MenuName2[14]="fUnction";
static char MenuName4[10]="Help";
static char OptionMenu1[3][7]={"O1Mnu1",
"O2Mnu1",
"O3Mnu1"
};
static char OptionMenu2[3][9]={" O1Mnu2 ",
" O2Mnu2 ",
" O3Mnu2 "
};
static char OptionMenu3[3][9]={" O1Mnu3 ",
" O2Mnu3 ",
" O3Mnu3 "
};
static char OptionMenu4[3][9]={" O1Mnu4 ",
" O2Mnu4 ",
" O3Mnu4 "
};
int getkey(int *key)/*显示时间函数*/
{strUCt time aa;
int a,b;
char time[20];
gettime(&aa);/*获取时间*/
a=aa.ti_sec;
while(!kbhit())
{
gettime(&aa);
b=aa.ti_sec;
if(abs(b-a)>=1)
{
a=b;
sPRintf(time,"%02d:%02d:%02d",aa.ti_hour,aa.ti_min,aa.ti_sec);
gotoxy(70,25);
textbackground(0);
textcolor(YELLOW);
cputs(time);
gotoxy(CurX,CurY); /* else cur stin on the right of time */
}
}
*key=bioskey(0);
}
DisplayMenu(int PosMenu,int PosOption)
{
int VarX,VarY,Var;
switch(PosMenu)
{
case 1:{
gotoxy(7,1);
textcolor(WH99vE);
textbackground(BLACK); /*显示菜单1的名字,其背景色相对初始界面改变*/
cprintf("%s",MenuName1);
textcolor(BLACK);textbackground(7);
for(VarX=7;VarX<=13;VarX++)
{gotoxy(VarX,2); /*menu1box画上边框*/
cprintf("%c",196);
gotoxy(VarX,6);
cprintf("%c",196); /*menu1box画下边框*/
}
for(VarY=3;VarY<=5;VarY++)
{gotoxy(6,VarY);
cprintf("%c",179);
gotoxy(14,VarY);
cprintf("%c",179);
}
gotoxy(14,6);
cprintf("%c",217); /*右下角*/
gotoxy(6,2);
cprintf("%c",218);/*左上角*/
gotoxy(6,6);
cprintf("%c",192);/*左下角*/
gotoxy(14,2);
cprintf("%c",191);/*右上角*/
/***显示各个菜单1的项目***/
for(Var=0;Var<3;Var++)
{gotoxy(6+2,2+Var+1);
cprintf("%s",&OptionMenu1[Var][0]);
}
/***显示菜单1选中选项的内容***/
gotoxy(6+1,2+PosOption);
textbackground(BLACK);
textcolor(WH99vE);
cprintf("%s",&OptionMenu1[PosOption-1][0]);
gotoxy(CurX,CurY);
break;
}
case 2:{
gotoxy(27,1);
textcolor(WH99vE);
textbackground(BLACK); /*显示菜单2的名字,其背景色相对初始界面改变*/
cprintf("%s",MenuName2);
textcolor(BLACK);textbackground(7);
for(VarX=27;VarX<=34;VarX++)
{gotoxy(VarX,2); /*menu1box画上边框*/
cprintf("%c",196);
gotoxy(VarX,6);
cprintf("%c",196); /*menu1box画下边框*/
}
for(VarY=2;VarY<=5;VarY++)
{gotoxy(26,VarY);
cprintf("%c",179);
gotoxy(35,VarY);
cprintf("%c",179);
}
gotoxy(35,6);
cprintf("%c",217); /*右下角*/
gotoxy(26,2);
&nb