dbgrid隔五行变色问题(50分)

  • 主题发起人 主题发起人 zhnf2001
  • 开始时间 开始时间
Z

zhnf2001

Unregistered / Unconfirmed
GUEST, unregistred user!
//-----帮助修改一下
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var i:integer;
begin
if ((adotable1.RecNo mod 4=0) and (adotable1.RecNo mod 4 =3)) then
(Sender as TDBGrid).Canvas.Brush.Color := clwhite //定义背景颜色
else // clinfobk 深黄
(Sender as TDBGrid).Canvas.Brush.Color :=clcream ; //淡黄
if ((State = [gdSelected]) or (State = [gdSelected, gdFocused])) then
if not DBGrid1.SelectedRows.CurrentRowSelected then
DBGrid1.Canvas.Brush.Color := clHighlight;
DBGrid1.Canvas.Pen.Mode := pmMask;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
 
recno? 不对,recoNo可以 为 -1
 
后退
顶部