procedure TForm1.dbgrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin With dbgrid1 do begin If Odd(adotable1.FieldByName('编号').AsInteger) then begin Canvas.Brush.Color:=$02E8F8F8; Canvas.FillRect(rect); Canvas.TextOut(rect.Left+2,rect.Top+2,field.AsString); end else begin Canvas.Brush.Color:=clwhite; Canvas.Font.Color:=$02330000; Canvas.FillRect(rect); Canvas.TextOut(rect.Left+2,rect.Top+2,field.AsString); end; If State=[gdSelected] then begin Canvas.Brush.Color:=$02445511; Canvas.Font.Color:=clWhite; end; end;
----------------------------------------------