if (cxGrid1 = nil) or (cxGrid1.FocusedView = nil) then
Exit;
AHeight := 0;
with cxGrid1.FocusedView as TcxGridDBTableView do
begin
ViewData.Collapse(True);
with cxGrid1DBTableView1.ViewInfo do
begin
for I := 0 to ARowsNumber - 1 do
begin
Inc(AHeight, RecordsViewInfo.Items[I].DataHeight);
if I < ARowsNumber - 1 then
Inc(AHeight, GridLineWidth);
end;
if OptionsView.GroupByBox then
Inc(AHeight, GroupByBoxViewInfo.Height);
Inc(AHeight, HeaderViewInfo.Bounds.Bottom - HeaderViewInfo.Bounds.Top);
end;
Inc(AHeight, GetSystemMetrics(SM_CYHSCROLL));
cxGrid1.Height := AHeight;