hallo,
was ist hier falsch? Es ändert sich nichts!
Delphi-Quellcode:
procedure TForm1.CRDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var Wert: string;
begin
if (CRDBGrid1.DataSource.DataSet.RecordCount = 0) then
begin
Exit;
Wert := EventQuery.FieldByName('STATUS').Value;
if Wert = 'System' then begin
CRDBGrid1.Canvas.Brush.Color := clblack;
CRDBGrid1.Canvas.Font.Color := cllime;
end else if Wert = 'Test' then begin
CRDBGrid1.Canvas.Brush.Color := clFuchsia;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = 'Button' then begin
CRDBGrid1.Canvas.Brush.Color := cllime;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = 'Termin' then begin
CRDBGrid1.Canvas.Brush.Color := clAqua;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = 'Unwetter' then begin
CRDBGrid1.Canvas.Brush.Color := clWhite;
CRDBGrid1.Canvas.Font.Color := clNavy;
end else if Wert = 'Geschlossen' then begin
CRDBGrid1.Canvas.Brush.Color := clgreen;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = 'Alarmiert' then begin
CRDBGrid1.Canvas.Brush.Color := clWhite;
CRDBGrid1.Canvas.Font.Color := clred;
end else begin
CRDBGrid1.Canvas.Brush.Color := clblack;
CRDBGrid1.Canvas.Font.Color := clwhite;
end;
CRDBGRid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;