c - 使用 Ncurses 绘制方框

标签 c ncurses

我目前正在尝试使用 ncurses 绘制一组框。此时此刻,我有代表这些盒子的长度和宽度的变量。一件事是我不允许使用像这样的命令 “WINDOW * win = newwin(10, 10, 1, 1);”。

如果我可以提供任何其他信息来帮助您帮助我,请告诉我。

最佳答案

对于盒子,你可以使用这个函数:

void rectangle(int y1, int x1, int y2, int x2)
{
    mvhline(y1, x1, 0, x2-x1);
    mvhline(y2, x1, 0, x2-x1);
    mvvline(y1, x1, 0, y2-y1);
    mvvline(y1, x2, 0, y2-y1);
    mvaddch(y1, x1, ACS_ULCORNER);
    mvaddch(y2, x1, ACS_LLCORNER);
    mvaddch(y1, x2, ACS_URCORNER);
    mvaddch(y2, x2, ACS_LRCORNER);
}

关于c - 使用 Ncurses 绘制方框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22399406/

相关文章:

c - 在 C 中标记字符串

c - Bison 中的一元优先级

user-interface - 如何做 ncurses 等。人。工作?

linux - Python 诅咒接口(interface)

C算法转化为代码: Coordinates within a certain parameter

c - 程序分析(递归)

rust - 使用get_wch读取Unicode字符

haskell - NCurses 不断更新 moveCursor 中的 x 和 y 坐标

c - Ncurses curs_set(0) tty

c - 使用带有标准输入的 fgets() 作为输入 : ^D fails to signal EOF