转!
重写控件:
procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override;
或响应 OnDrawCell 事件:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1 do
begin
Canvas.Pen.Color := clRed;
Canvas.MoveTo(Rect.Left - 1, Rect.Top);
Canvas.LineTo(Rect.Left - 1, Rect.Bottom);
end;
end;