![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-31 12:18 |
47,815 topics / 349,930 posts / today 0 new / 48,290 members |
| DOS开发编程 & 发展交流 (开发室) » Repost: DOS graphical Chinese menu written in TC2.0 |
| Printable Version 1,236 / 0 |
| Floor1 MYS | Posted 2003-11-12 00:00 |
| 元老会员 Posts 1,637 Credits 5,170 From 广东佛山 | |
|
DOS graphical Chinese menu written in TC2.0
This is the only message View: Original Format Online forums: cn.comp.lang.c, cn.fan Date: 2002-07-21 10:56:58 PST This is a fairly comprehensive graphical Chinese menu for operation under DOS that I wrote myself! But the current directory needs to contain a few font files that come with UCDOS: hzk24h and hzk24k /*--------------------------------------------------------------------------- File: MENU.C Function: Operate MainMenu ---------------------------------------------------------------------------*/ # define MAX_FRAME 4 # define UP 72 # define DOWN 80 # define LEFT 75 # define RIGHT 77 # define ESC 27 # define F1 59 # define DEL 83 # define SPACE 32 # define ENTER 13 # define Alt_X 45 # define Alt_Y 21 # define Alt_D 32 # define Alt_T 20 # define Alt_O 24 # define BackSpace 8 struct gmenu{ int left,top; char *menuname; char *submenu; int count,width; }menuframe={ {15,31,"Database Operations (D)",{"Open database file", "Show database structure", "Show record contents", "Search records", "Close database file", "-", "Exit ALT+X"},7,14,}, {175,31,"Function Graphs (T)",{"SIN function", "COS function", "TAN function", "CTG function", "-", "Group B design"},6,12,}, {335,31,"Software (DIY)",{"Window color", "Window font color", "Main menu settings", "Submenu settings", "-", "System fill pattern", "User-defined pattern",},7,12,}, {480,31,"Others (O)",{"Mouse in Maze ", "Serial port communication transfer", "Music appreciation ", "-", "System restore", "Help F1", "About"},7,12,}}; char *title="Comprehensive C Language Program Design"; int diy_style=1,diy_ufill=-1,diy_color=BLUE,diy_bkcolor=LIGHTGRAY,chang=0; int diy_sgkcolor=RED,diy_sgcolor=WHITE,diy_mgkcolor=CYAN,diy_mgcolor=BLUE; int setmenu(void) { int title_x=200; setbkcolor(BLUE); setcolor(WHITE); Tbox(2,2,getmaxx()-2,getmaxy()-2,LIGHTGRAY,BLUE,4); dis_hz(title_x,8,title,YELLOW); Tline(6,getmaxy()-32,getmaxx()-6,getmaxy()-32); setfillstyle(0,1);bar(10,getmaxy()-28,getmaxx()-10,getmaxy()-7); dis_hz(10,getmaxy()-28,"Operation guide: please choose.........",WHITE); dis_hz(getmaxx()-12-7*16,getmaxy()-28,"Exit ALT+X",WHITE); listtopmenu();return 0; } int listtopmenu(void) { int i; Tbutton(7,28,getmaxx()-8,53,diy_bkcolor,diy_color,NULL,0,diy_style); for (i=0;i<MAX_FRAME;i++) Tbutton(menuframe.left,menuframe.top,menuframe.left+(strlen(menuframe.menuname)+2)*8,menuframe.top+20,diy_bkcolor,diy_color,menuframe.menuname,0,diy_style); return 0; } int loadmenu(int which) {int i,keylr,size,sleft,stop,zwidth,swidth,scount,atop,ptop,subwhich; void *buffer; subwhich=keylr=sleft=stop=0; while (1) {setfillstyle(0,1);bar(90,getmaxy()-28,getmaxx()-8*16,getmaxy()-7); dis_hz(90,getmaxy()-28,menuframe.submenu,WHITE); sleft=menuframe.left;stop=menuframe.top; zwidth=sleft+(strlen(menuframe.menuname)+2)*8; swidth=sleft+(menuframe.width+2)*8+10; scount=menuframe.count;atop=stop+30; for (i=0;izwidth)?swidth:zwidth)+(which==2?2:12),atop+stop); if (size!=-1) buffer=malloc(size); if (keylr==0||change==2||(buffer&&(keylr==LEFT||keylr==RIGHT))) { getimage(sleft,stop,((swidth>zwidth)?swidth:zwidth)+(which==2?2:12),atop+stop,buffer);change=0; } Tbutton(sleft,stop,zwidth,stop+19,diy_mgkcolor,diy_mgcolor,menuframe.menuname,0,diy_style); Tbutton(sleft+4,stop+30,swidth+7,atop+15,diy_bkcolor,diy_color,NULL,0,diy_style); ptop=stop+40; for (i=0;i<scount;i++) { if (strcmp("-",menuframe.submenu)==0) { Tline(sleft+8,ptop+3,swidth+5,ptop+3); ptop+=10;} else { if (subwhich==i) Tbutton(sleft+13,ptop,sleft+25+(menuframe.width)*8,ptop+22,diy_sgkcolor,diy_sgcolor,menuframe.submenu,0,diy_style); else Tbutton(sleft+13,ptop,sleft+25+(menuframe.width)*8,ptop+22,diy_bkcolor,diy_color,menuframe.submenu,0,diy_style); ptop+=30; } } switch (keylr=inkey()) { case Alt_X: quit();break; case F1 : help();break; case ESC: which=-1;break; case LEFT: which=which==0?MAX_FRAME-1:which-1;subwhich=0;listtopmenu();break; case RIGHT: which=which==MAX_FRAME-1?0:which+1;subwhich=0;listtopmenu();break; case UP: subwhich=(subwhich==0)?scount-1:subwhich-1; if (strcmp(menuframe.submenu,"-" ==0)subwhich--;break; case DOWN: subwhich=(subwhich==scount-1)?0:subwhich+1; if (strcmp(menuframe.submenu,"-" ==0)subwhich++;break; case ENTER: clear(); if (which==0) { if (subwhich==0) openfile(); if (subwhich==1) list_db_structure(); if (subwhich==2) list_db_recorder(); if (subwhich==3) db_search(); if (subwhich==4) closefile(); if (subwhich==6) quit(); } if (which==1) if (subwhich==5) {system("fpk" ;cleardevice();setmenu();}else draw(subwhich+1); if (which==2) { if (subwhich==0) set_bkcolor(); if (subwhich==1) set_color(); if (subwhich==2) set_mcolor(); if (subwhich==3) set_scolor(); if (subwhich==5) set_fillstyle(); if (subwhich==6) set_filluser(); } if (which==3) { if (subwhich==0) {system("maze" ;cleardevice();setmenu();}if (subwhich==1) message(menuframe.submenu); if (subwhich==2) playmusic(); if (subwhich==4) reset(); if (subwhich==5) help(); if (subwhich==6) welcome(); } clear(); } if (buffer&&(keylr==LEFT||keylr==RIGHT)) {putimage(sleft,stop,buffer,COPY_PUT);clear();} free(buffer); if (change==1) {listtopmenu();clear();change=2;} if (which>8; return (key); } -- _ _ \ / Little bug that loves eating beans ,,,,,,,,,, ( @ @) icq:128660888 OICQ:981348 (__(__(__(_) ( ^ ) E-mail:[email protected] ^ ^ ^ ^ ^ ~ Welcome to subscribe to the "China Newsgroup Union" news://news.bugnews.dns2go.com/虫网.关于杂志 http://www.cn99.com/cgi-bin/getlsts?listname=newsgroup Welcome to news://news.cn99.com/cn.fan A newsgroup for Chinese fans, a home for Chinese fans...... |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |