c语言文本编辑器源代码 含窗口,关于文本编辑器

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include

#include

#include

#include

#include

#include

#define DOWN     0x5000

#define UP       0x4800

#define ESC      0x011b

#define ALT_F    0x2100

#define ALT_X    0x2d00

#define ENTER    0x1c0d

void box(int startx,int starty,int high,int width);

main()

{

int i,key,x,y,l;

char *menu[]={"File","Edit","Run","Compile","Project","Options","Window","Help"};

char *red[]={"F","E","R","C","P","O","W","H"};

char *f[]={"New file","Load file","Save","Save as...","Quit      Alt_x"};

char buf[16*8*2],buf1[16*2];

while(1)

{

textmode(C80);

textbackground(BLUE);

clrscr();

window(1,1,80,1);

textbackground(LIGHTGRAY);

textcolor(BLACK);

clrscr();

gotoxy(5,1);

for(i=0,l=0;i<8;i++)

{

x=wherex();

y=wherey();

cprintf("%s",menu[i]);

l=strlen(menu[i]);

gotoxy(x,y);

textcolor(RED);

cprintf("%s",red[i]);

x=x+l+2;

gotoxy(x,y);

textcolor(BLACK);

}

gotoxy(5,1);

key=bioskey(0);

switch(key){

case ALT_X:

exit(0);

case ALT_F:

{

textbackground(BLACK);

textcolor(WHITE);

gotoxy(5,1);

cprintf("%s",menu[0]);

gettext(4,2,19,9,buf);

window(4,2,19,9);

textbackground(CYAN);

textcolor(BLACK);

clrscr();

box(1,3,9,16);

for(i=2;i<7;i++)

{

gotoxy(2,i);

cprintf("%s",f[i-2]);

}

gettext(4,3,19,3,buf1);

textbackground(BLACK);

textcolor(WHITE);

gotoxy(2,2);

cprintf("%s",f[0]);

gotoxy(2,2);

y=2;