发布网友
共1个回答
热心网友
给楼主一段代码,可以自动计算窗口大小的变化量,希望会有用吧。
procere TFStateReopen.FormCreate(Sender: TObject);
begin
InitClientHeight:= ClientHeight; //要先在窗体类中声名这些Integer变量
InitClientWidth:= ClientWidth;
CurClientHeight:= ClientHeight;
CurClientWidth:= ClientWidth;
end;
procere TFStateReopen.FormResize(Sender: TObject);
begin
inherited;
//计算可视组件的坐标变化
HeightInc:= ClientHeight - CurClientHeight;
if HeightInc > 0 then
begin
CurClientHeight:= ClientHeight;
end;
if (HeightInc < 0) and (ClientHeight > InitClientHeight) then
begin
CurClientHeight:= ClientHeight;
end;
if (HeightInc <0) and (ClientHeight <= InitClientHeight) then
begin
HeightInc:= InitClientHeight - CurClientHeight;
CurClientHeight:= InitClientHeight;
end;
WidthInc:= ClientWidth - CurClientWidth;
if WidthInc > 0 then
begin
CurClientWidth:= ClientWidth;
end;