procedure TForml.FormCreate(Sender: TObject); Const Orignwidth=1024; Orignheight=768; begin scaled:=true; if (screen.width<>orignwidth) then begin height:=longint(height)*longint (screen.height) div orignheight; width:=longint(width)*longint (screen.width) div orignwidth; scaleby(screen.width , orignwidth); end; end;
大小不可变的 form, 尺寸不要大于 800*600, 640*480的就不考虑了吧, 显示位置不要用default,改用screen center或desktop center
可变的from
.注意使用anchors属性,要跟着右边变大小的组件,把 akRight设true,这个很灵活,多尝试一下组合
.用Panel给form作分割,设置所有Panel align,可变大小的分割用Splitter组件,进一步控制应最好记下各Panel的位置到配置文件,下次程序起动就按上次用户关闭时的位置
Const
Orignwidth=1024;
Orignheight=768;
begin
scaled:=true;
if (screen.width<>orignwidth) then
begin
height:=longint(height)*longint
(screen.height) div orignheight;
width:=longint(width)*longint
(screen.width) div orignwidth;
scaleby(screen.width , orignwidth);
end;
end;