delphi 程序適應屏幕分辨率,先在表單單元的Interface部分定義兩個常量,
表示設計時的屏幕的寬度和高度(以像素為單位)。
在表單的Create事件中先判斷 當前分辨率是否與設計分辨率相同,
如果不同,調用表單的SCALE過程重新能調整表單中控件的寬度和高度。
Const Orignwidth=800; Orignheight=600;
procedure TForm1.FormCreate(Sender:TObject);
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;
http://blog.csdn.net/cmdasm/article/details/45324559