M
meiguibao
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TEnterTime.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
oldcolor:tcolor;
oldpm:tpenmode;
begin
if DateToStr(now) = DateToStr(Dmd.WorkTime.FieldByName('workdate').AsDateTime) Then
begin
oldpm:= DbGrid1.Canvas.pen.mode;
oldcolor:= DbGrid1.Canvas.Brush.color;
DbGrid1.Canvas.Brush.color:=clyellow;
DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
DbGrid1.Canvas.Brush.color:=oldcolor;
DbGrid1.Canvas.pen.mode:=oldpm;
end;
end;
以上的代码不知为什么,当在DBGRID中行发生变化后,颜色变化不正常.请指教
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
oldcolor:tcolor;
oldpm:tpenmode;
begin
if DateToStr(now) = DateToStr(Dmd.WorkTime.FieldByName('workdate').AsDateTime) Then
begin
oldpm:= DbGrid1.Canvas.pen.mode;
oldcolor:= DbGrid1.Canvas.Brush.color;
DbGrid1.Canvas.Brush.color:=clyellow;
DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
DbGrid1.Canvas.Brush.color:=oldcolor;
DbGrid1.Canvas.pen.mode:=oldpm;
end;
end;
以上的代码不知为什么,当在DBGRID中行发生变化后,颜色变化不正常.请指教