procedure TFrmSellOpenOrder.dbgridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
dbgrid.Canvas.Pen.Mode:=pmmask;
with dbgrid do
begin
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
begin
Canvas.Font.Color :=ClYellow;
Canvas.Brush.Color :=ClNavy;
end
else
begin
if datamoduleerp.ADOQSALEDETAIL.RecNo mod 2<>0 then {判断当前数据是奇数还是偶数行}
Canvas.brush.Color :=ClRed {如果是奇数行,DBGrid背景以白色显示}
else
Canvas.brush.Color :=$00EAEAEA; {如果是偶数行,DBGrid背景以浅灰色显示}
end;
dbgrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
dbgrid.Canvas.Pen.Mode:=pmmask;
with dbgrid do
begin
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
begin
Canvas.Font.Color :=ClYellow;
Canvas.Brush.Color :=ClNavy;
end
else
begin
if datamoduleerp.ADOQSALEDETAIL.RecNo mod 2<>0 then {判断当前数据是奇数还是偶数行}
Canvas.brush.Color :=ClRed {如果是奇数行,DBGrid背景以白色显示}
else
Canvas.brush.Color :=$00EAEAEA; {如果是偶数行,DBGrid背景以浅灰色显示}
end;
dbgrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;