PageControl控件的高度自适应(遍历tabSheet内所有控件)

maxHeight := 0;
with cxPageControl1.ActivePage do
begin
for i := 0 to ControlCount - 1 do
begin
t := TControl(Controls[i]);
if maxHeight < (t.Top + t.Height) then
begin
maxHeight := t.Top + t.Height;
end;
end;
end;

if maxHeight > 21 then
cxPageControl1.Height := maxHeight + 21
else
cxPageControl1.Height := 21;

posted @ 2017-08-21 15:07  penginfo  阅读(400)  评论(0)    收藏  举报