home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc / qc25 / coltext.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-15  |  810 b   |  37 lines

  1. /* COLTEXT.C: Displays text in color */
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <graph.h>
  5.  
  6. char buffer [80];
  7.  
  8. main()
  9. {
  10.    int blink,fgd;
  11.    long bgd;
  12.  
  13.    _clearscreen( _GCLEARSCREEN );
  14.    printf( "Text color attributes:\n" );
  15.  
  16.    for( blink=0; blink<=16; blink+=16 ) 
  17.    {
  18.       for( bgd=0; bgd<8; bgd++ ) 
  19.       {
  20.          _setbkcolor( bgd );
  21.          _settextposition( bgd + ((blink / 16) * 9) + 3, 1 );
  22.          _settextcolor( 7 );
  23.          sprintf( buffer, "Bgd: %d Fgd:", bgd );
  24.          _outtext( buffer );
  25.          
  26.          for( fgd=0; fgd<16; fgd++ ) 
  27.          {
  28.             _settextcolor( fgd+blink );
  29.             sprintf( buffer, " %2d ", fgd+blink );
  30.             _outtext( buffer );
  31.          }
  32.       }
  33.    }
  34.    getch();
  35.    _setvideomode( _DEFAULTMODE );
  36. }
  37.