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 试试带参数的 exit

Delphi cross socket的库

Delphi的split函数 4个版本

Delphi模拟点击网页中的按钮

Delphi tms web core twebhttprequest使用

Delphi datetimepicker控件日期格式

Delphi twebbrowser 设置焦点

Delphi adoquery filter使用

Delphi 判断一目录是否共享

Delphi 取得dll所在目录

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



打赏

取消

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

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

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

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

评论

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