ZeeGrid Programming Reference

Cell COLOR Attribute


Cell COLOR Attribute

Every ZeeGrid cell as a foreground (FCOLOR) and background (BCOLOR) color attribute. The ZeeGrid title (cell index 0) and the column headers can only make use of the foreground color attribute.

Every ZeeGrid control holds a 128 color palette that contains the RGB values of 128 color entries. Colors 0..19 are predefined by ZeeGrid and are always available for use, but cannot changed. Palette colors 20..127 can be defined and changed by the programmer using the ZGM_SETCOLOR message function.

The ZeeGrid message functions to set cell background or foreground colors, use color parameters that are indexes into the ZeeGrid color palette. This way, a sufficient number of colors can be used in the grid cells, and only require 2 bytes of memory storage to define both the foreground (text) color, and the background color of the cell.

The 20 (0..19) predefined color palette entries are defined as follows:


        color[0] = RGB(0,0,0);      //black   - EXAMPLE                               
        color[1] = RGB(0,0,255);    //blue    - EXAMPLE                               
        color[2] = RGB(0,255,0);    //green   - EXAMPLE                               
        color[3] = RGB(0,255,255);  //aqua    - EXAMPLE                               
        color[4] = RGB(255,0,0);    //red     - EXAMPLE                               
        color[5] = RGB(255,0,255);  //magenta - EXAMPLE                               
        color[6] = RGB(255,255,0);  //yellow  - EXAMPLE                               
        color[7] = RGB(255,255,255);//white   - EXAMPLE                               
        color[8] = GetSysColor(COLOR_BTNFACE);       //based on OS display settings   
        color[9] = GetSysColor(COLOR_BTNSHADOW);     //based on OS display settings   
       color[10] = GetSysColor(COLOR_HIGHLIGHT);     //based on OS display settings   
       color[11] = GetSysColor(COLOR_HIGHLIGHTTEXT); //based on OS display settings   
       color[12] = GetSysColor(COLOR_INFOBK);        //based on OS display settings   
       color[13] = GetSysColor(COLOR_INFOTEXT);      //based on OS display settings   
       color[14] = RGB(0,255,255); //mark text normal         - EXAMPLE               
       color[15] = RGB(0,196,196); //mark text fixed columns  - EXAMPLE               
       color[16] = RGB(0,0,0); //mark text foreground         - EXAMPLE               
       color[17] = 0; //NULL_BRUSH for using with bitmap background.                  
       color[18] = 0; //reserved for future use                                       
       color[19] = 0; //reserved for future use                                       


By default, every cell has a foreground color of black and a background color of white.

It is possible to animate ZeeGrid colors by manipulating the ZeeGrid color palette entries in response to a WM_TIMER message.

ZeeGrid messages that relate to colors:

ZeeGridTMCopyright © 2002-2016 by David Hillard