如何确定cxGrid网格数据的高度

procedure SetGridHeight(AGrid: TcxGrid; ARowsNumber: Integer);  

var  

  I: Integer;  

  AHeight: Integer;  

begin  

  if (AGrid = nil) or (AGrid.FocusedView = nil) then  

    Exit;  

  AHeight := 0;  

  with AGrid.FocusedView as TcxGridDBTableView do  

  begin  

    ViewData.Collapse(True);  

    with 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));  

    AGrid.Height := AHeight;  

  end;  

end;
THE END
文章版权归作者所有,未经允许请勿转载。
点赞11赞赏
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片