Ver Mensaje Individual
  #8  
Antiguo 18-04-2008
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
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

Última edición por roman fecha: 18-04-2008 a las 18:36:18.
Responder Con Cita