Partiendo del código de
Neftalí podríamos intentar detectar cuando son necesarias las barras:
Código Delphi
[-]
procedure TExtendedDBGrid.WMNCCalcSize(var msg: TMessage);
var
Style: Integer;
begin
if Assigned(DataSource) and Assigned(DataSource.DataSet) then
begin
Style := GetWindowLong(Handle, GWL_STYLE);
if DataSource.DataSet.RecordCount > VisibleRowCount then
Style := Style or WS_VSCROLL
else
Style := Style and not WS_VSCROLL;
SetWindowLong(Handle, GWL_STYLE, Style);
end;
inherited;
end;
// Saludos