Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

colored stringgrid cell

Status
Not open for further replies.

Regany

Programmer
Aug 27, 2004
72
0
0
LV
How to make colored stringgrid cell by parameter? For example: if value in cell is equal to 5 then it will be green..
 
use the DrawCell event:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
if Cells[acol,arow]='5' then begin
canvas.Font.color :=clgreen;
canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[acol,arow]);
end;
end;

Hope it helps !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top