delphi窗体自适应分辨率


本文整理自网络,侵删。

 delphi窗体自适应分辨率

窗口、控件以及字体大小均随分辨率而变化,让界面适应各种不同的分辨率。

var
FWidth: Integer;
begin
inherited;
if (Screen.width <> 1024) then
begin
FWidth := Self.width;
Scaled := True;
Font.Size := (Self.width DIV FWidth) * Font.Size; // 字体大小调整
ScaleBy(Screen.width, 1024); // 控件大小调整
Self.Height := longint(Height) * longint(Screen.Height) DIV 768;
Self.width := longint(width) * longint(Screen.width) DIV 1024; // 窗口大小调整
end;
FScale := Screen.width / 1024;

if FScale <> 1 then
begin
for i := 0 to DBGrid1.Columns.Count - 1 do
begin
if DBGrid1.Columns[i].Visible then
begin
DBGrid1.Columns[i].width := Trunc(DBGrid1.Columns
[i].width * FScale);
end;
end;
end;

相关阅读 >>

Delphi reset 以只读方式打开文件

Delphi将image存入mysql数据库

Delphi整理一(基础知识)

Delphi 除法 "/" 与 div 的不同

Delphi对access文件加密

Delphi getdrivetypea() 查看驱动器类型

Delphi extractclassname 字符串处理函数

Delphi debug权限提升

Delphi判断某一个点是否在一个区域内

Delphi 正确得到本地ip

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...