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 在windows平台下实现进程隐藏

Delphi中关于时间差的实例

winapi 字符及字符串函数(2): charlowerbuff - 把缓冲区中指定数目的字符转小写

Delphi中adoquery执行错误的捕捉

Delphi idhttpserver使用注意问题

Delphi通过进程名获取进程pid函数

Delphi申请和释放内存

Delphi 2009 的反射单元(objauto):

Delphi 中窗体form显示在第二个显示器中的方法

Delphi 以十六进制显示数据内容

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



打赏

取消

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

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

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

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

评论

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