?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
getyx()和move()。getyx()函数其实是一个定义在
ncurses.h 中的宏,它会l出当前光标的位|,需要注意的是我们不能用指针作ؓ参数Q只
能传递一Ҏ型变量(前文提到q)。函数move()光标移动到指定位置
调用attron()函数开始启动文字修饎ͼ当找到?/”(注释l束处标志)的地方,׃调用attroff()函数停止为后l文字l添加修饰?/p>
A_NORMAL 普通字W输?不加亮显C?
A_STANDOUT l端字符最?/p>
A_UNDERLINE 下划U?/p>
A_REVERSE 字符反白昄
A_BLINK 闪动昄
A_DIM 半亮昄
A_BOLD 加亮加粗
A_PROTECT 保护模式
A_INVIS I白昄模式
A_ALTCHARSET 字符交替
A_CHARTEXT 字符掩盖
COLOR_PAIR(n) 前景、背景色讄
在两U修饰属性间加一个“|”字W:
attron(A_BOLD | A_BLINK)?
dp@dp:~/cursestest % cat 2.c
#include
#include
int main(){
//init_pair(short index,short foreground,short background)初始化颜色烦?/p>
//attron(COLOR_PAIR(索引?|属?
//newwin建立H口,derwin建立H口的子H口(相对于父H口相对位置)Qsubwin建立H口的子H口(相对于根H口l对位置)
setlocale(LC_ALL,"");
char mesg[]="您的名字:"; /* 要被打印的字符串信?/
char name[80];
int y,x;
initscr();//初始?/p>
mvprintw(1,1,"WIN1");
mvprintw(2,1,"您好");
mvprintw(3,1,"%s",mesg);
getyx(stdscr, y, x);
move((y+2),2);
attron(A_REVERSE);
printw("*********************");
refresh();
attroff(A_REVERSE);
getyx(stdscr, y, x);
move((y-1),1);
scanw("%s",name);
mvprintw(6,1,"%s好,很高兴认识您", name);
refresh();
endwin();//l束
return 0;
}
dp@dp:~/cursestest % gcc -lncursesw 2.c -o mytest
dp@dp:~/cursestest % ./mytest