印刷内部窗口,而不是在边界 [英] Printing inside window, not on borders
本文介绍了印刷内部窗口,而不是在边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图写一个诅咒窗口内的东西,但它似乎对边界写太多。如何解决下面的code?
win_self =为newwin(行/ 2,COLS,0,0);
框(win_self,0,0);
wrefresh(win_self);
wprintw(win_selfFOOBAR);
解决方案
在诅咒,框()按产生的边框的在的边界。据我所知,有没有办法简单地说不覆盖我的境界。
不过,也有,我能想到的,现在三种解决方法:
- 请不要覆盖边界字符(使用
移动()
) - 画箱的之后的绘制窗口内容,那么
刷新()
屏幕(你可能还覆盖的东西,但至少它不是边境字符) - 创建一个边窗带边框和一个内容窗口在它的内部,这当然在开始(border_window_start_y + 1,border_window_start_x + 1),是比边窗小两行/列LI>
这只是为了更清楚:箱()
函数不添加属性窗口有明显的边界的窗口,它只是打印周围的窗口边框字符
您有:
- 免费覆盖的边界字符
- 应该是谨慎的,如果你不想让他们覆盖
I'm trying to write something inside a curses window, but it seems to write on borders too. How can I fix the code below?
win_self = newwin(LINES / 2, COLS, 0, 0);
box(win_self, 0, 0);
wrefresh(win_self);
wprintw(win_self, "foobar");
解决方案
In curses, the borders generated by box()
are inside borders. As far as I can tell, there's no way to simply say "don't overwrite my border".
Nevertheless, there are three solutions that I can think of right now:
- don't overwrite the border characters (use
move()
) - draw the box after you draw window contents, then
refresh()
the screen (you're probably still overwriting something, but at least it's not the border characters) - create a "border window" with borders and a "content window" inside of it, which of course starts at (border_window_start_y + 1, border_window_start_x + 1) and is two lines/columns smaller than the "border window"
Just to make it more clear: the box()
function doesn't add the property "this window has visible borders" to the window, it just prints border characters around the window.
You are:
- free to overwrite those border characters
- supposed to be cautious if you don't want them overwritten
这篇关于印刷内部窗口,而不是在边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文