TC20寫的DOS底下文字選單 (轉)
很象用TURBO VISION寫的介面。
/*
DATE:05/2000
TOPIC:文字選單
pass by:turboc 20
*/
# include
# include
# include
# include
# include
# include
# include
# include
# include <.h>
# include
# include
# define SCREENMINX 0
# define SCREENMINY 0
# define SCREENMAXX 79
# define SCREENMAXY 24
#define WindowMaxX 79
#define WindowMinX 0
#define WindowMaxY 24
#define WindowMinY 0
/* #define BLINK 0x80 */
#define LIGHT 0x08
#define WHITE 0x07
#define BLACK 0x00
#define RED 0x04
#define GREEN 0x02
#define BLUE 0x01
#define MIXCOLOR(A,B) A|B
#define LIGHTSHOW(A) A|LIGHT
#define DARKSHOW(A) A&0xf7
#define BLINKSHOW(A) A|BLINK
#define NOTBLINKSHOW(A) A&0x7f
#define BACKCOLOR(A) A<<4
#define MIX(A,B) (A | BACKCOLOR(B))
#define GetBackColor(A) ((A&0x70)>>4)
#define GetForeColor(A) A&0x0f
#define EnabledMenuItem MIX(BLACK,WHITE)
#define EnabledMenuItem MIX(BLACK,GREEN)
#define DisabledSelectMenuItem MIX(LIGHSHOW(BLACK),BLACK)
#define DisabledMenuItem MIX(LIGHSHOW(BLACK),WHITE)
# define INSERT 0x5200
# define ESC 0x001b
# define TAB 0x0f09
# define RETURN 0x000d
# define RIGHT 0x4d00
# define LEFT 0x4b00
# define UP 0x4800
# define DOWN 0x5000
# define BS 0x0e08
# define HOME 0x4700
# define END 0x4f00
# define PGUP 0x4900
# define PGDN 0x5100
# define DEL 0x5300
# define F1 0x3b00
# define F2 0x3c00
# define F3 0x3d00
# define F4 0x3e00
# define F5 0x3f00
# define F6 0x4000
# define F7 0x4100
# define F8 0x4200
# define F9 0x4300
# define F10 0x4400
# define MenuInGround 1
# define MenuActiveGround 2
# define MenuActiveItem 3
# define MenuInItem 4
# define MenuEdge 5
# define WindowEdge 6
# define WindowGround 7
# define PopWindow 8
/*
unsigned char AllColors[20] = { 0 ,CYAN , LIGHTRED , YELLOW ,
BLACK , WHITE , LIGHTRED,BLUE,
CYAN ,9 ,10,11 ,12 ,13 ,14,15} ;
*/
typedef unsigned char UCHAR;
typedef unsigned int UINT;
typedef unsigned long ULONG;
char edge[7]={0xda,0xc4,0xbf,0xb3,0xd9,0xc0,''};
/* char edge1[7]={}; */
#define INUM 10 /* R maximum IO itenls in each MENU w */
typedef struct _menu
{
char coor[4]; /* The menu's area w */
char itemcoor[4 * INUM]; /* max IO item, each with xl,yl ,x2,y2 w */
char itemdispxy[2 * INUM] ; /* Actually disp item name's X coor w */
char select; /* selected item's ord # */
char itemnum; /* The number of items in this menu w */
char **itemname; /* w item's name(point to static data) R */
int COMMAND_ID[INUM]; /* w Key number R */
}MENUTYPE ;
static char * MainMenuItem[]= {" File "," Edit "," Run "," Compile "," Help ",
" Exit ", 0 };
static char *Syshelp=" F1-Help F5-Zoom F6-Switch F7-Trace F8-Step F9-Make F10-Menu";
static char * SubMenuItem1[]= {" Load File... F3 ",
" Pick File Alt+F3 ",
" New ",
" Save F2 ",
" Write to ",
" ",
" Quit Alt+X ",0};
/*
static char *SubMenuItem[6][]={{"Help11..."},
{
*/
static char * SubMenuItem2[]= {" Item21...",
" Draw ",
" Item23 ",
" Item24 ",
" Item25 ",
" Item26 ",
" Item27 ",
" Item28 ",0};
static char * SubMenuItem3[]= {" Item31... ",
" Item32... ",
" Item add... ",
" Item33 ", 0 };
static char * SubMenuItem4[]= {" Item41... ",
" Item42... ",
" Moving Text ",
" Item44 ",
" Item45 ",
" item ** ", 0} ;
static char * SubMenuItem5[]= {" Help Index F1 ",
" About... ",
" System Info ",0};
static char * SubMenuItem6[]= {0};
void getitemcount(char ** ,int * ,int * ,int * );
void LoadMainMenu(void);
void LoadSubMenu(char **name, int ord);
int ManageSubMenu (void ) ;
void ManageMainMenu (void) ;
void DisplayMainMenu (void ) ;
int DisplaySubMenu (int ord) ;
void Help_page_show(void) {return ; } ;
void Exitmenu (int) ;
void In_ActiveMainMenuItem(int select , char In_Active) ;
void In_ActiveSubMenuItem(int ord , int select , char In_Active) ;
int GetKey (void) ;
void FuncProc (int ID) ;
void Draw(void) ;
void MoveText (void) ;
void About (void) ;
void MessageBox(char * Message) ;
void Gooye(char * pcInf1 , char * pcInf2) ;
void win();
char gettextattrib();
void settextattrib();
void cprintfxy();
char *textbuf;
MENUTYPE MainMenu , SubMenu[INUM] ;
/* int maxx, texth, textw; */
void main(void)
{
clrscr();
win(0,1,SCREENMAXX+1,SCREENMAXY,'xb0',BLUE<<4|LIGHTSHOW(GREEN));
cprintfxy(25,9,"Analytic Hierarchy Process",BLUE<<4|BLACK);
cprintfxy(26,11,"Howard.Hsu & WeiGuoZhang",BLUE<<4|BLACK);
cprintfxy(33,18,"05/18/2000",BLUE<<4|BLACK);
win(0,24,80,1,' ',WHITE<<4|BLUE);
LoadMainMenu();
LoadSubMenu (SubMenuItem1 , 0);
LoadSubMenu (SubMenuItem2 , 1);
LoadSubMenu (SubMenuItem3 , 2);
LoadSubMenu (SubMenuItem4 , 3);
LoadSubMenu (SubMenuItem5 , 4);
LoadSubMenu (SubMenuItem6 , 5);
ManageMainMenu();
}
void prncharxy(char xpos,char ypos,char ch,char attrib)
{
char far *p=(char far *)0xb8000000;
if(xpos
ypos
return;
*(p+ypos%25*160+2*(xpos%80))=ch;
*(p+ypos%25*160+2*(xpos%80)+1)=attrib;
return;
}
void cprintfxy(char xpos,char ypos,char *string,char attrib)
{
int len,i;
if(xpos
ypos
return;
len=strlen(string);
for(i=0;i
return;
}
void vcprintfxy(char xpos,char ypos,char string[],char attrib)
{
int len,i;
if(xpos
ypos
return;
len=strlen(string);
for(i=0;i
return;
}
void drawbox(char xpos,char ypos,char width,char heigh,
char *edge,char attrib,char *title){
char i,j,len;
if(xpos
ypos
return;
prncharxy(xpos,ypos,edge[0],attrib);
prncharxy(xpos+width-1,ypos,edge[2],attrib);
prncharxy(xpos+width-1,ypos+heigh-1,edge[4],attrib);
prncharxy(xpos,ypos+heigh-1,edge[5],attrib);
for(i=0;i
prncharxy(xpos+i+1,ypos+heigh-1,edge[1],attrib);
}
for(i=0;i
prncharxy(xpos+width-1,ypos+i+1,edge[3],attrib);
}
len=strlen(title);
cprintfxy(xpos+width/2-len/2,ypos,title,attrib);
for(i=0;i
settextattrib(xpos+width,ypos+i+1,(BLACK<<4)|(WHITE));
settextattrib(xpos+width+1,ypos+i+1,(WHITE)|(WHITE));
}
for(i=0;i
for(i=1;i
return;
}
void win(char xpos,char ypos,char width,char heigh,char ch,char attrib)
{
char i,j;
if(xpos
ypos
return;
for(i=0;i
return;
}
char *malloctextbuf(char width,char heigh)
{
char *buf;
if((buf=(char *)malloc(2*width*heigh*sizeof(char)))==NULL)
return NULL;
else
return buf;
}
void gettextxy(char xpos,char ypos,char width,char heigh,char *buf)
{
char i,j;
char far *vp=(char far *)0xb8000000;
if(xpos
ypos
return;
if(xpos+width>SCREENMAXX)
width=SCREENMAXX+1-xpos;
if(xpos+heigh>SCREENMAXY)
heigh=SCREENMAXY+1-ypos;
for(i=0;i
buf[i*2*width+j]=*(vp+(ypos+i)%25*160+2*(xpos%80)+j);
return;
}
char gettextattrib(char xpos,char ypos){
char far *p=(char far *)0xb8000000;
if(xpos
ypos
return;
return(*(p+ypos%25*160+2*(xpos%80)+1));
}
void settextattrib(char xpos,char ypos,char attrib){
char far *p=(char far *)0xb8000000;
if(xpos
ypos
return;
*(p+ypos*160+2*xpos+1)=attrib;
return;
}
void puttextxy(char xpos,char ypos,char width,char heigh,char *buf)
{
char i,j,w,h;
char far *vp=(char far *)0xb8000000;
if(xpos
ypos
return;
if(xpos+width>SCREENMAXX)
w=SCREENMAXX+1-xpos;
else
w=width;
if(ypos+heigh>SCREENMAXY)
h=SCREENMAXY+1-ypos;
else
h=heigh;
for(i=0;i
*(vp+(ypos+i)%25*160+2*(xpos%80)+j)=buf[i*2*width+j];
return;
}
void ManageMainMenu (void )
{
unsigned key;
int ID;
DisplayMainMenu();
for(key=0;;)
{
key=GetKey() ;
switch(key)
{
case LEFT :
In_ActiveMainMenuItem(MainMenu.select ,0) ;
if(MainMenu.select<1) /* w Already leftest item in mainmenu # */
MainMenu.select =MainMenu.itemnum - 1 ;
else
MainMenu.select--;
In_ActiveMainMenuItem(MainMenu.select , 1 ) ; /* R Light bar N */
break ;
case RIGHT :
In_ActiveMainMenuItem(MainMenu.select , 0);
if(MainMenu.select>MainMenu.itemnum-2)
MainMenu.select=0;
else
MainMenu.select++;
In_ActiveMainMenuItem(MainMenu.select,1);
break;
case DOWN:
case RETURN:
switch(MainMenu.COMMAND_ID[MainMenu.select] ){
case 5: /*# Exit to DOS # */
if (key==DOWN)
break ;
GoodBye ("Goodbye from ", "the MENU DEMO in graphics mode.");
break ;
default :
ID = ManageSubMenu ();
if (ID >=0)
FuncProc (ID);
break ;
}
}
}
}
void FuncProc (int ID)
{
char *buf;
switch ( ID ){
case 6: /*w 006 FileIQuit # */
GoodBye("Goodbye from ", "the BvIENU DEMO in graphics mode. ") ;
break ;
case 101:
Draw() ;
break ;
case 302:
MoveText();
break ;
case 401:
About ( ) ;
break ;
default :
buf=malloctextbuf(30+2,8+1);
gettextxy(25,10,30+2,8+1,buf);
drawbox(25,10,30,8,edge,RED<<4|GREEN," MessgeBox ");
getch();
puttextxy(25,10,30+2,8+1,buf);
free(buf);
break ;
}
}
/* ManageSubMenu() retarn an int value that is s /
/# Il there is a error # /
/# Return to main menu, nothing to do # /
/ =O or =>O; the COMMAND_ID of a menu item w */
int ManageSubMenu (void)
{
MENUTYPE * mn = &SubMenu[MainMenu.select] ;
unsigned key ;
if(DisplaySubMenu(MainMenu.select)) /* w Out of memory * */
return -2;
for(key=0;;)
{
key=GetKey () ;
switch (key ){
case ESC: /* # return to MainMenu # */
Exitmenu(MainMenu.select);
return -1 ;
case UP:
In_ActiveSubMenuItem(MainMenu.select , mn->select,0);
if(mn->select>0)
mn->select--;
else
mn->select = mn->itemnum - 1 ;
In_ActiveSubMenuItem(MainMenu.select , mn->select ,1 );
break ;
case DOWN:
In_ActiveSubMenuItem (MainMenu. select , mn ->select , 0);
if (mn ->select
mn->select++;
else
mn->select=0;
In_ActiveSubMenuItem (MainMenu.select , mn->select ,1);
break ;
case LEFT:
Exitmenu (MainMenu.select);
In_ActiveMainMenuItem (MainMenu.select , 0);
if(MainMenu.select<1) /* e Already leftest item in mainmenu w */
MainMenu.select = MainMenu.itemnum- 1 ;
else
MainMenu.select-- ;
In_ActiveMainMenuItem(MainMenu.select , 1) ; /* # Light bar e */
if(DisplaySubMenu(MainMenu.select) )/* Out of mentory w */
return -2;
mn= &SubMenu[MainMenu.select] ;
break ;
case RIGHT :
Exitmenu (MainMenu.select ) ;
In_ActiveMainMenuItem(MainMenu.select , 0);
if(MainMenu.select>MainMenu.itemnum-2)/* # already rightest w */
MainMenu.select = 0;
else
MainMenu.select++ ;
In_ActiveMainMenuItem (MainMenu.select , 1);
if (DisplaySubMenu(MainMenu.select) ) /* # Out of memory w */
return -2 ;
mn = &SubMenu[MainMenu. select];
break ;
case RETURN :
Exitmenu (MainMenu.select );
return mn->COMMAND_ID[mn->select] ;
}
}
}
void LoadMainMenu()
{
int count ,totallen ,maxlen ,i;
int beginx;
MainMenu.coor[0]= SCREENMINX;
MainMenu.coor[1] =SCREENMINY;
MainMenu.coor[2] =SCREENMAXX;
MainMenu.coor[3] =SCREENMINY;
getitemcount(MainMenuItem, &count ,&totallen ,&maxlen) ;
MainMenu.itemnum =count ;
beginx=3;
for(i= 0;i
MainMenu.itemcoor[i*4] = beginx; /* w xl # */
MainMenu.itemcoor[i*4+1] = MainMenu.coor[1]; /* w yl w */
MainMenu.itemcoor[i*4+2] = beginx+strlen(MainMenuItem[i]); /* # x2 # */
MainMenu.itemcoor[i*4+3] = MainMenu.coor[3];
MainMenu.itemdispxy[i*2] = beginx; /* w actuall disp X w */
MainMenu.itemdispxy[i*2+1] = MainMenu.coor[3]; /* w actuall disp Y w */
MainMenu.COMMAND_ID[i] = i ;
beginx=beginx+strlen(MainMenuItem[i])+1;
}
MainMenu.itemname = MainMenuItem ;
}
void LoadSubMenu(char ** name ,int ord)
{
int count ,i ,j ,maxlen;
getitemcount(name , &count , &i , &maxlen) ;
SubMenu[ord].itemname = name ;
SubMenu [ord].itemnum =count ;
j=maxlen+1;
if(j+MainMenu.itemcoor[4 * ord]
SubMenu[ord].coor[0] =MainMenu.itemcoor[4 * ord]; /*w item's xl w */
SubMenu[ord].coor[2] =SubMenu[ord].coor[0] +j ;
}
else /* w Use right justification because of space w */
{
SubMenu[ord].coor[2]=MainMenu.itemcoor[2]; /* # left just use X2 w */
SubMenu[ord].coor[0] =SubMenu[ord].coor[2] -j;
}
if(count==0)
{
SubMenu[ord].coor[1] =SubMenu[ord].coor[1]+1; /* w The item's y2*/
SubMenu[ord].coor[3] =SubMenu[ord].coor[1];
}
else
{
SubMenu[ord].coor[1]=MainMenu.itemcoor[4*ord+3]+1;
SubMenu[ord].coor[3]=SubMenu[ord].coor[1] + count+1;
}
for(i=0;i
SubMenu[ord].itemcoor[i * 4] =SubMenu[ord].coor[0]+1;
SubMenu[ord].itemcoor[i * 4+1]=SubMenu[ord].coor[1]+i+1;
SubMenu[ord].itemcoor[i * 4+2] =SubMenu[ord].coor[2]-1;
SubMenu[ord].itemcoor[i * 4+3] = SubMenu[ord].itemcoor[i * 4+1] +i+1;
SubMenu[ord].itemdispxy[i * 2] =SubMenu[ord].itemcoor[i * 4];
SubMenu[ord].itemdispxy[i * 2+1] =SubMenu[ord].itemcoor[i * 4+1];
SubMenu[ord].COMMAND_ID[i] = ord * 100+i ;
}
}
void DisplayMainMenu (void )
{
unsigned i ;
win(MainMenu.coor[0],MainMenu.coor[1],80,1,' ',WHITE<<4|BLACK);
for(i= 0 ;i
if(MainMenu.select==i)
In_ActiveMainMenuItem (i , 1) ;
else
cprintfxy ( MainMenu.itemdispxy[i * 2],
MainMenu.itemdispxy[i * 2+1] ,
MainMenu.itemname[i],WHITE<<4|BLACK) ;
}
}
char *textbuf;
int DisplaySubMenu (int ord )
{
unsigned size , i;
MENUTYPE * mn = &SubMenu[ord] ;
textbuf=NULL;
textbuf=malloctextbuf(mn->coor[2]-mn->coor[0]+1+2,
mn->coor[3]-mn->coor[1]+1+1);
if(textbuf==NULL)
{
clrscr();
printf("nOut of memory!");
printf("nPress any key...");
getch();
return 1;
}
if(mn->coor[1]==mn->coor[3])
return 0;
gettextxy(mn->coor[0],mn->coor[1],
mn->coor[2]-mn->coor[0]+1+2,
mn->coor[3]-mn->coor[1]+1+1,textbuf);
drawbox(mn->coor[0],mn->coor[1],
mn->coor[2]-mn->coor[0]+1,
mn->coor[3]-mn->coor[1]+1,edge,WHITE<<4|BLACK,"");
for(i =0;i
{
if(i==mn->select)
In_ActiveSubMenuItem(ord , i , 1);
else
{
cprintfxy(mn->itemdispxy[i*2],mn->itemdispxy[i*2+1],mn->itemname[i],WHITE<<4|BLACK);
}
}
return 0 ;
}
static void Exitmenu (int ord )
{
MENUTYPE *mn=&SubMenu[ord] ;
if(textbuf)
{
puttextxy(mn->coor[0],mn ->coor[1],mn->coor[2]-mn->coor[0]+1+2,
mn->coor[3]-mn->coor[1]+1+1,textbuf);
free (textbuf);
}
}
void In_ActiveMainMenuItem(int select , char In_Active)
{
MENUTYPE * tp = &MainMenu ;
if (In_Active==0) /* H off w */
{
cprintfxy (tp->itemdispxy[select * 2] ,
tp->itemdispxy[select * 2+ 1] ,
tp ->itemname [select],(WHITE<<4)|BLACK) ;
}
else
{
cprintfxy (tp->itemdispxy[select * 2] ,
tp->itemdispxy[select * 2+1] ,
tp ->itemname [select],(GREEN<<4)|BLUE) ;
}
}
void In_ActiveSubMenuItem(int ord , int select , char In_Active)
{
MENUTYPE * tp =&SubMenu[ord] ;
if (In_Active==0) /* w off w */
{
cprintfxy(tp->itemdispxy[select * 2] ,
tp ->itemdispxy[select * 2+1],
tp ->itemname [select],(WHITE<<4)|BLACK) ;
}
else
{
cprintfxy (tp->itemdispxy[select * 2] ,
tp->itemdispxy[select *2+ 1],
tp ->itemname[select],(GREEN<<4)|BLUE) ;
}
}
int GetKey(void){
int key;
key=bioskey(0);
if(key==F1)
Help_page_show();
else
if(key<<8)
{
key=key&0x00ff;
if(isalpha(key))
key=toupper(key);
}
return key;
}
static void getitemcount(char ** s ,int * count,int * len,int * maxlen)
{
int i,j;
for(( * maxlen)=0,(*len)=0,i=0; s[i]!=NULL; i++)
{
j =strlen (s[i]);
(*len)+=j;
if(j>(*maxlen))
( * maxlen) =j ;
}
( *count)=i;
}
void Draw(void)
{
int x, x1, x2, y1, y2;
ranize ( ) ;
do
{
x1 = random (WindowMaxX-WindowMinX) +WindowMinX ;
y1 = random (WindowMaxY-WindowMinY) +WindowMinY ;
x2 = random (WindowMaxX-WindowMinX) +WindowMinX ;
y2 = random (WindowMaxY-WindowMinY) +WindowMinY ;
if (x1>x2)
{
x = x1; x1= x2; x2=x;
}
if (y1>y2)
{
x=y1;y1 =y2;y2=x;
}
if(y1<1)
y1=1;
if(y2>23)
y2=23;
win(x1,y1,x2-y1+1,y2-y1+1,' ',random(256));
delay(100);
}while(!bioskey(1));
}
void About (void)
{
char MidX, MidY, x1, y1, x2, y2, size;
char *buf1;
MidX = (WindowMaxX - WindowMinX)/2 ;
MidY = (WindowMaxY - WindowMinY)/2 ;
x1 = MidX-15;
x2 = MidX+15;
y1 = MidY-4;
y2 = MidY+4;
buf1=malloctextbuf(x2-x1+1+2,y2-y1+1+1);
gettextxy(x1,y1,x2-x1+1+2, y2-y1+1+1,buf1) ;
/* win(WindowMinX,WindowMinY,WindowMaxX, WindowMaxY,' ',BLUE); */
if ( buf1==NULL)
{
clrscr();
printf("nOut of memory!Press any key to exit...");
getch ( ) ;
exit(1);
}
else
{
gettextxy(x1 ,y1 , x2-x1+1+2,y2-y1+1+1, buf1) ;
drawbox(x1,y1,x2-x1+1,y2-y1+1,edge,WHITE," About... ");
cprintfxy(MidX-strlen("Menu Demo")/2,MidY-2,"Menu Demo",RED);
cprintfxy(MidX-strlen("In Text Mode")/2,MidY-1,"In Text Mode",RED);
cprintfxy(MidX-strlen("05/2000 By")/2,MidY,"05/2000 By",RED);
cprintfxy(MidX-strlen("Howard.Hsu")/2,MidY+1,"Howard.Hsu",RED);
cprintfxy(MidX-strlen(" OK ")/2,MidY+2," OK ",GREEN);
getch() ;
puttextxy(x1,y1,x2-x1+1+2,y2-y1+1+1,buf1);
free (buf1);
}
}
void DrawButtonUp(unsigned char xpos,unsigned char ypos,
char *message,char attrib)
{
unsigned char len,i;
char BackAttrib;
BackAttrib= gettextattrib(xpos,ypos);
len=strlen(message);
prncharxy(xpos,ypos,' ',attrib);
cprintfxy(xpos+1,ypos,message,attrib);
prncharxy(xpos+len+1,ypos,' ',attrib);
prncharxy(xpos+len+2,ypos,240,BackAttrib);
for(i=0;i<=len+2;i++)
prncharxy(xpos+i+1,ypos+1,220,BackAttrib);
return;
}
void DrawButtonDown(unsigned char xpos,unsigned char ypos,
char *message,char attrib)
{
unsigned char len,i;
char BackAttrib;
BackAttrib= gettextattrib(xpos,ypos+1);
len=strlen(message);
prncharxy(xpos,ypos,' ',BackAttrib);
prncharxy(xpos+1,ypos,' ',attrib);
cprintfxy(xpos+2,ypos,message,attrib);
prncharxy(xpos+len+2,ypos,' ',attrib);
for(i=0;i<=len+2;i++)
prncharxy(xpos,ypos+1,' ',BackAttrib);
return;
}
void MessageBox(char * Message)
{
int MidX, MidY, x1, y1, x2, y2, size, Len;
char *buf1;
MidX = (WindowMaxX - WindowMinX)/2 ;
MidY = (WindowMaxY - WindowMinY)/2 ;
Len = strlen(Message)>strlen(" MessageBox ")?strlen(Message):strlen(" MessageBox ");
x1 = MidX-Len;
x2=MidX+Len;
y1=MidY-4;
y2=MidY+4;
buf1=malloctextbuf(x2-x1+1+2,y2-y1+1+1);
if ( buf1==NULL)
{
clrscr();
printf("nOut of memory! Press any key to continue...");
getch( );
exit(1);
}
else
{
gettextxy(x1 ,y1 , x2-x1+1+2,y2-y1+1+1, buf1) ;
drawbox(x1,y1,x2-x1+1,y2-y1+1,edge,GREEN<<4|RED," MessageBox ");
cprintfxy(MidX-strlen(Message)/2,MidY-1,Message,GREEN<<4|BLUE);
DrawButtonUp(MidX-strlen("OK")/2-2,MidY+2,"OK",RED);
getch();
DrawButtonDown(MidX-strlen("OK")/2-2,MidY+2,"OK",RED);
delay(5000);
puttextxy(x1 ,y1 ,x2-x1+1+2,y2-y1+1+1,buf1) ;
free(buf1) ;
}
}
void MoveText (void )
{
int i;
char attrib;
win(0,1,80,23,' ',0);
for (i=random(80); i>1; i-=2)
{
attrib= gettextattrib(i,14);
cprintfxy(i ,14, "Menu example !",((BLUE<<4)&0x80)|RED) ;
delay(2000) ;
cprintfxy(i,14, " ",attrib);
}
}
void GoodBye(char * pcInf1 , char * pcInf2)
{
int f;
clrscr ( );
window(1 ,1 ,80,1) ;
textbackground (LIGHTBLUE ) ;
clrscr() ;
highvo ( );
textcolor(WHITE);
cprintf(pcInf1);
textcolor(YELLOW);
cprintf(pcInf2);
window(1,1,80,25);
printf("n");
for(f=400;f<800;f+=100)
{
sound(f);
delay(100);
}
nosound();
exit(0);
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-990469/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 將選中的下拉選單值寫入文字框
- 文字轉化工具dos2unix
- JavaScript帶下拉選單的文字框JavaScript
- mfc下改變選單的文字
- shell寫的控制選單
- 用VB編寫簡單的程式來清空文件選單 (轉)
- 如何在 Unix 和 DOS 格式之間轉換文字檔案
- 我使用過的Linux命令之dos2unix - 將DOS格式文字檔案轉換成UNIX格式Linux
- Cocos2dx之文字選單和圖片選單的使用
- 選單(轉)
- 簡單開發的DOS指令
- 用VB編寫一個彈出選單類 (轉)
- VC++的選單控制和自繪選單。 (轉)C++
- dos2unix, unix2dos 對應的命令(轉)
- 右鍵選單中的文字文件新增快捷鍵
- 用匯編編寫DOS下的記憶體駐留程式(5) (轉)記憶體
- 用匯編編寫DOS下的記憶體駐留程式(3) (轉)記憶體
- 用匯編編寫DOS下的記憶體駐留程式(4) (轉)記憶體
- Shell:如何寫一個多選選單的指令碼指令碼
- 禁用文字選擇、右鍵選單例項程式碼單例
- Shell文字處理編寫單行指令的訣竅
- 轉 轉別人寫的用dwr做聯動選單的例子,自己覺得也不錯
- jquery實現的獲取選中select下拉選單的值和文字jQuery
- PDF轉文字檔案的最簡單方法
- jquery如何獲取select下拉選單選中項的值和文字jQuery
- Windows XP 增強的DOS命令(轉)Windows
- 在dos下使用簡單的ftp命令FTP
- 【shell 練習5】編寫簡單的多級選單
- dwg、dxf檔案多行文字轉單行文字
- 自繪選單的實現 (轉)
- GRUB選單隱藏的解除(轉)
- js獲取select下拉選單的value和文字值JS
- 【開源我寫的富文字】打造全網最勁富文字系列之技術選型
- Swift - 仿寫QQ側滑選單Swift
- Billy Belceb病毒編寫教程(DOS篇)---病毒編寫所需的軟體
- 選單列舉記 (轉)
- DIV下拉式選單(轉)
- 表單元素文字內容選中事件onselect事件