挣点分还不容易。
procedure TFmSaleInvoice.GridDispDetailDrawColumnCell(Sender: TObject;
const Rect: TRect;
DataCol: Integer;
Column: TColumnEh;
State: TGridDrawState);
begin
inherited;
if cdsDetail.Active then
case cdsDetail.FieldByName('AID_NoteType').AsInteger of
0, -1:
begin
TDBGridEh(Sender).Canvas.Font.Color := clRed;{不设置字体不要这句}
TDBGridEh(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State); {不设置字体不要这句}
TDBGridEh(Sender).Canvas.Pen.Color := clRed;
TDBGridEh(Sender).Canvas.Pen.Width := 1;
TDBGridEh(Sender).Canvas.MoveTo(Rect.Left, Rect.Top + 5);
TDBGridEh(Sender).Canvas.LineTo(Rect.Right, Rect.Top + 5);
end;
end;
end;
注意所用的事件是onDrawColumnCell