频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

文本模式下的GUI设计,使用tc2.0 (2)

来源: 作者: 出处:巧巧读书 2006-09-10 进入讨论组

/*对该站的建议:希望下载能够开放些,真的很想要那些东东啊!可我现在还不是高级会员。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进入讨论组讨论。

更多专题 【深 度 阅 读】 相 关 文 章
    收藏此文】【 】【打印】【关闭
    相关图文阅读
    频道图文推荐
    健 康 咨 询
    时 尚 咨 询
    巧巧读书宗旨
    相关专题
    讨论组问题推荐
    站内各频道最新更新文档
    站内最新制作专题
    热门关键字导读
    Photoshop教 程照片处理 照片制作 PS快捷键 抠图
    计 算 机 故 障XP系统修复
    艺 术 与 设 计设计 流媒体 设计欣赏 边框
    计 算 机 安 全ARP
    站内频道文章精选
    巧巧电脑频道编辑信箱  告诉我们您想看的专题或文章