hallo,
möchte gerne im CRDBGrid einen Rahmen fett in rot darstellen!
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
Exit;
Wert := CRDBGrid1.DataSource.DataSet.FieldByName('STATUS').Value;
if Wert = 'Eingang' then begin
CRDBGrid1.Canvas.Brush.Color := clHotLight;
CRDBGrid1.Canvas.Font.Color := clWhite;
end else if Wert = '0' then begin
CRDBGrid1.Canvas.Brush.Color := $000080FF;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = '1' then begin
CRDBGrid1.Canvas.Brush.Color := clyellow;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = '2' then begin
CRDBGrid1.Canvas.Brush.Color := cllime;
CRDBGrid1.Canvas.Font.Color := clblack;
end else if Wert = '3' then begin
CRDBGrid1.Canvas.Brush.Color := clgreen;
CRDBGrid1.Canvas.Font.Color := clWhite;
end else begin
CRDBGrid1.Canvas.Brush.Color := clWhite;
CRDBGrid1.Canvas.Font.Color := clblack;
end;
CRDBGRid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
if (gdSelected in State) then
begin
CRDBGrid1.Canvas.Brush.Color:= clred;
CRDBGrid1.Canvas.Font.Style := [fsbold]; // das scheint falsch zu sein!
end;
CRDBGrid1.Canvas.FrameRect(Rect);
end;