下载此文档

C 语言窗口程序.doc


文档分类:IT计算机 | 页数:约11页 举报非法文档有奖
1/11
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/11 下载此文档
文档列表 文档介绍
# include <>
# include <>
# include <>
# include <>
# include <>
# include <>
int video_mode(void);
void goto_xy(int x,int y);
void set_v_ptr();
void write_char(int x,int y,char ch,int attrib);
void write_string(int x,int y,char *p,int attrib);
background color.
const enum clr
{
black,blue,green,cyan,red,magenta,brown,lightgray,darkgray,lightblue,lightgreen,lightcyan,lightred,lightmagenta,yellow,white,blink=128
};
char far *vid_mem;
class wintype
{
int leftx;
int upy;
int rightx;
int downy;
int border;
int active;
char *title;
int curx,cury;
char *buf;
char color;
void save_screen();
void restore_screen();
void draw_border();
void display_title();
public:
wintype(int lx,int uy,int rx,int ly,int b=1,char *mess="");
wintype()
{
winremove();delete buf;
}
void winput();
void winremove();
int winputs(char *s);
int winxy(int x,int y);
void wingets(char *s);
int wingetche();
void wincls();
void wincleol();
void setcolor(char c)
{
color=c;
}
char getcolor()
{
return color;
}
void setbkcolor(char c)
{
color=color | (c<<4);
}
char getbkcolor()
{
return (color>>4)&127;
}
friend wintype&operator<<(wintype&o,char *s);
frient wintype&operator>>(wintype&o,char *s);
};
wintype::wintype(int lx,int uy,int rx,int ly,int b, char *mess)
{
if(lx<0)lx=0;
if(rx>79)rx=79;
if(uy<0)uy=0;
if(ly>24)ly=24;
leftx=lx;
upy=uy;
rightx=rx;
downy=ly;
border=b;
title=mess;
active=0;
curx=cury=0;
buf=new char[2*(rightx-leftx+1)*(downy-upy+1)];
if(!buf)
{
cout<<"Allocation error\n";
exit(1);
}
color=white;
}
void wintype::winput()
{
if(!active)
{
save_screen();
active=1;
}
else return;
if(border)draw_border();
display_title();
goto_xy(leftx+curx=1;upy+cury+1);
}
void wintype::winremove()
{
if(!active)return;
restore_screen();
active=0;
}
void wint

C 语言窗口程序 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数11
  • 收藏数0 收藏
  • 顶次数0
  • 上传人aena45
  • 文件大小30 KB
  • 时间2021-07-11
最近更新