Delphi fmx中获取窗口比例


本文整理自网络,侵删。

 

从柏林Delphi 10.1起,不推荐使用IFMXWindowService.GetWindowScale。

以前,按如下方式获得窗口比例:

procedure TForm1.FormCreate(Sender: TObject);
var
ws: IFMXWindowService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXWindowService, ws) then
    Memo1.Lines.Add('缩放:' + FloatToStr(ws.GetWindowScale(Self)));  
    //[DCC 警告] Unit1.pas(34): W1000 符号,符号 'GetWindowScale'不建议使用
end;
现在,此方法显示警告。

在Delphi 10.1 Berlin中,使用窗体的句柄的Scale属性。

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Lines.Add('缩放:' + FloatToStr(Self.Handle.Scale));
end;

相关阅读 >>

Delphi读取radiogroup选中按钮的string文本

Delphi-dbgrid取得所有表中的值

Delphi 之 tmemo组件使用

Delphi 24位真彩色图形转化为ico文件

Delphi windowsapi: muldiv

Delphi sql 语句(常见) 新建,删除,修改表结构

Delphi 字符串左右添加字符

Delphi tstrings 随机打乱

Delphi 开启内存泄漏报告模式

Delphi 2009 之 tcategorypanelgroup[3]: color

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



打赏

取消

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

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

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

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

评论

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