通过query1.locate()查找数据后,数据所在行变蓝。
procedure TzhcxFrm.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect
DataCol: Integer
Column: TColumn;
State: TGridDrawState);
begin
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
DbGrid1.Canvas.Brush.color:=$00C08000;// 当前行以红色显示,其它行使用背景的浅绿色
DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);
end;