bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw a colorful border using wborder ?


From: Thomas Dickey
Subject: Re: How to draw a colorful border using wborder ?
Date: Sat, 20 Dec 2008 11:27:52 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Dec 19, 2008 at 05:58:13PM +0800, John Daker wrote:
> Hi all
> I want to draw a border with blue background white line, and my code is:
> 
> win=newwin(15,70,15,300);
> werase(win);
> init_pair(1,COLOR_WHITE,COLOR_BLUE);
> wattrset(win,COLOR_PAIR(1));
> 
> int x,y;
> for(y=0;y<15;y++)
> for(x=0;x<70;x++)
> waddch(win,' ');
> wborder(win,0,0,0,0,0,0,0,0);
> 
> But the border's background is black while other area is blue, How to draw a
> colorful border using wborder ?

man wborder

DESCRIPTION
       The  border,  wborder and box routines draw a box around the edges of a
       window.  Other than the window, each argument is a character  with  at-
       tributes:

You have to add the colors to the character, e.g.,

#define colored_ctype(ch, attr, pair) \
        ((ch) | (attr) | COLOR_PAIR(pair))

    wborder(stdscr,
            colored_chtype(ACS_VLINE,    attr, pair),
            colored_chtype(ACS_VLINE,    attr, pair),
            colored_chtype(ACS_HLINE,    attr, pair),
            colored_chtype(ACS_HLINE,    attr, pair),
            colored_chtype(ACS_ULCORNER, attr, pair),
            colored_chtype(ACS_URCORNER, attr, pair),
            colored_chtype(ACS_LLCORNER, attr, pair),
            colored_chtype(ACS_LRCORNER, attr, pair));

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]