Registriert seit: 26. Nov 2003
Ort: Halle/Saale
4.343 Beiträge
Delphi 11 Alexandria
|
Re: StringGrid -> Zelle farblich
23. Okt 2007, 11:53
Beispiel mit OnDrawColumnCell:
Delphi-Quellcode:
procedure TFormAw.DBGridFaelligeVorgaengeDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var ErledigtFlag:Boolean;
begin
if (Sender is TDBGrid) then with (Sender as TDBGrid) do begin
ErledigtFlag:=False;
if Assigned(Column.Field) then begin
if (Column.Field.DataSet.FindField('Erledigt')<>nil) then begin
ErledigtFlag:=(Column.Field.DataSet.FieldByName('Erledigt').AsBoolean);
end;
end;
if (ErledigtFlag) then begin
Canvas.Brush.Color:=clSilver;//$00B3B3FF;//clYellow;
Canvas.Pen.Color:=clBlack;//clRed;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end
else
if ((Column.Title.Caption='Termin') or (Column.Title.Caption='AbgelaufenAm')) then begin
if Assigned(Column.Field) then begin
if (Column.Field is TDateField) then begin
if ((Column.Field.AsDateTime>0) and (Column.Field.AsDateTime<Date)) then begin
// if ((Fields.FindField('Status')<>nil) and (Column.FieldByName('Status...').AsString<>'...ok')) then begin
Canvas.Brush.Color:=$00B3B3FF;//clYellow;
Canvas.Pen.Color:=clRed;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
// end;
end;
end;
end;
end;
end;
end;
stahli
|
|
Zitat
|