VFP Grid - Can cells be diff. colors?

VFP Grid - Can cells be diff. colors?

Post by Douglas William » Sun, 13 Aug 1995 04:00:00



I have been experimenting with VFP and the Grid control.  I
would like to be able to have cells within the same column be
different colors (the backcolor property) depending on the
value in the field that is the source for this cell/column.  
From what I can see so far, you can change the color of the
cells of an entire column, but not the cells separately.  Does
anyone know if this is possible?  Presently, we use Truegrid in
a VB app and it allows this along with other more powerful
features than the VFP grid.

Thanks..douglas

 
 
 

VFP Grid - Can cells be diff. colors?

Post by Denni » Sun, 13 Aug 1995 04:00:00


Quote:>    The back color of the individual cells can be >changed in run-time by
>the setting of 'DynamicBackColor' property of Column.
>Example:
>Grid1.DynamicBackColor =
>"IIF (MOD(RECNO(),3), RGB(255,0,0), RGB (0,0,255))"
>****** Every third row is red. The others are blue.
>Alan Kwan

Actually, DynamicBackColor is a property of a column,
so the correct line is:

Grid1.Column1.DynamicBackColor = ;
  "IIF (MOD(RECNO(),3), RGB(255,0,0), RGB (0,0,255))"

You may also want to use SetAll method of a grid
to set a property of all columns with just one command.

Here is an example from VFP on line help:

grdGrid1.SetAll("DynamicBackColor", ;
        "IIF(MOD(RECNO( ), 2)=0, RGB(255,255,255) ;
        , RGB(0,255,0))", "Column")
* Alternate white and green records

FYI, VFP grid has a bunch of other 'Dynamic' properties
like DynamicForeColor, DynamicFontSize, DynamicFontName
etc.

Hope it helps.

Also, hope other features of TrueGrid are available
in VFP grid, but as they were not specified, it is
impossible to comment.

Dennis.

 
 
 

VFP Grid - Can cells be diff. colors?

Post by Alan Kw » Mon, 14 Aug 1995 04:00:00



>I have been experimenting with VFP and the Grid control.  I
>would like to be able to have cells within the same column be
>different colors (the backcolor property) depending on the
>value in the field that is the source for this cell/column.  
>From what I can see so far, you can change the color of the
>cells of an entire column, but not the cells separately.  Does
>anyone know if this is possible?  Presently, we use Truegrid in
>a VB app and it allows this along with other more powerful
>features than the VFP grid.
>Thanks..douglas

Douglas,

        The back color of the individual cells can be changed in run-time by
the setting of 'DynamicBackColor' property of Column.

Example:

Grid1.DynamicBackColor =

"IIF (MOD(RECNO(),3), RGB(255,0,0), RGB (0,0,255))"
****** Every third row is red. The others are blue.

Alan Kwan

 
 
 

1. VFP 6.0 - Changing grid cell colors

Is there a way to change the BackColor of an individual cell in a grid.
I'm able to change to BackColor of an entire row or column, but not an
individual cell.

any help is greatly appreciated. Please reply to:


or to this group. Thanks in advance.

2. DSN in VB

3. Grid and color of cells

4. indexing TABLES

5. Applying colors to individual cells in a grid

6. Pdox4.5 - Running under Win95

7. Grid cell-level color

8. how to color pivot table's cell

9. How to change color of individual cell DataGrid.

10. DBGrid Cell Coloring

11. Cell coloring

12. Colors in cells on DBgrid ?