setbkcolor function in graphics

C graphics program to set background color.          
  • General syntax to set background color is
    setbkcolor(int color).
  • bkcolor is used to set background color of the screen.
  • Its take only one argument it may be a int or char data type.
  • In setbkcolor function we can choose color by its int value(0-15) or by color name

The following table shown color name and it corresponding int value.

Colorint value
BLACK0
BLUE1
GREEN2
CYAN3
RED4
MAGENTA5
BROWN6
LIGHTGRAY7
DARKGRAY8
LIGHTBLUE9
LIGHTGREEN10
LIGHTCYAN11
LIGHTRED12
LIGHTMAGENTA13
YELLOW14
WHITE15

C program to set background

#include <graphics.h>
#include <stdio.h>



int main( )
{
        int gd=DETECT, gm;
        initgraph(&gd,&gm,"C:\\tc\\bgi");

        setbkcolor(1);
        getch();
        closegraph();

       return 0;
}


setbkcolor function of c graphics
Download


0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.