Hola Jimmy
Conozco una forma para colorear solamente una celda de una grilla, no es muy corta pero es la que conozco. Allí va:
If you want to add colour coding to a grid to be able to visually differentiate between records and/or cells, add 2 new fields (fore_color C(11), back_color C(11)) to the .RecordSource table of Grid1.
Add a new form method called .mGridColours() and a new form property called .nRecNo.
In the .Init event of Grid1 put:-
THISFORM.nRecNo = RECN([TABLENAME])
THIS.Refresh()
In the .AfterRowColChange() event of Grid1 put:-
THISFORM.nRecNo = RECN([TABLENAME])
THIS.Refresh()
In the .Column(s) of the grid set .Sparse = .F. and .DynamicCurrentControl = THISFORM.mGridColours().
In the .mGridColours() method put:-
WITH THISFORM.Grid1
DO CASE
CASE THISFORM.nRecNo = RECN([TABLENAME])
.Column1.Text1.Forecolor = RGB(255,255,255)
.Column1.Text1.Backcolor = RGB(0,0,128)
CASE TABLENAME.fore_color = [R/W]
.Column1.Text1.Forecolor = RGB(255,0,0)
.Column1.Text1.Backcolor = RGB(255,255,255)
CASE TABLENAME.fore_color = [B/W]
.Column1.Text1.Forecolor = RGB(0,255,0)
.Column1.Text1.Backcolor = RGB(255,255,255)
CASE TABLENAME.fore_color = [G/W]
.Column1.Text1.Forecolor = RGB(0,0,255)
.Column1.Text1.Backcolor = RGB(255,255,255)
ENDC
ENDW
You will find the .Forecolor properties of the cells will reflect the value selected by TABLENAME.fore_color, with the currently selected record highlighted.
If you want the fields TABLENAME.fore_color and TABLENAME.back_color to determine the colours displayed, then :-
DO CASE
CASE ALLT(TABLENAME.fore_color) = [255,255,0]
lcColor = [.Column1.Text1.Forecolor = RGB(]+ALLT(TABLENAME.fore_color)+[)]
&lcColor
lcColor = [.Column1.Text1.Backcolor = RGB(]+ALLT(TABLENAME.back_color)+[)]
&lcColor
ENDC
Si tienes alguna duda, pregunta.
Saludos.
Walter.
Hotmail: Trusted email with powerful SPAM protection.
Sign up now.