添加窗体的oncreate事件: procedure TForm1.FormCreate(Sender: TObject); const Orignwidth=800; Orignheight=600; 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;
根 据 新 的 分 辨 率 自 动 重 画 表 单 及 控 件 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; 将 机 器 分 辨 率 更 改 为 设 计 时 的 分 辨 率 procedure TForm1.FormCreate(Sender: TObject); var devmode:tDevicemode; begin if screen.width<>orignwidth then begin if EnumDisplaySettings(nil,0,devmode) then begin devmode.dmfields:=dm_pelswidth OR dm_pelsheight ; devmode.dmpelswidth:=orignwidth; {宽度} devmode.dmpelsheight:=orignheight;{高度} ChangeDisplaySettings(devmode,0); {更改设置} end; end; end;
procedure TForm1.FormCreate(Sender: TObject);
const
Orignwidth=800;
Orignheight=600;
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;
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;
将 机 器 分 辨 率 更 改 为 设 计 时 的 分 辨 率
procedure TForm1.FormCreate(Sender: TObject);
var
devmode:tDevicemode;
begin
if screen.width<>orignwidth then
begin
if EnumDisplaySettings(nil,0,devmode) then
begin
devmode.dmfields:=dm_pelswidth OR dm_pelsheight ;
devmode.dmpelswidth:=orignwidth; {宽度}
devmode.dmpelsheight:=orignheight;{高度}
ChangeDisplaySettings(devmode,0); {更改设置}
end;
end;
end;
这样窗体的大小也不改变,只不过没有了最大化和最小化按钮了