D
delphilike
Unregistered / Unconfirmed
GUEST, unregistred user!
我知道可以动态设置dbgrid中的字段颜色,如下程序
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Table1.FieldByName('Population').AsInteger > 20000000 then
DBGrid1.Canvas.Font.Color := clBlue;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
想请问如何实现改变当前记录的前景和背景
以区分是当前记录呢?
首先应该判断是否当前记录吧
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Table1.FieldByName('Population').AsInteger > 20000000 then
DBGrid1.Canvas.Font.Color := clBlue;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
想请问如何实现改变当前记录的前景和背景
以区分是当前记录呢?
首先应该判断是否当前记录吧