本文整理自网络,侵删。
从柏林Delphi 10.1起,不推荐使用IFMXWindowService.GetWindowScale。
以前,按如下方式获得窗口比例:
procedure TForm1.FormCreate(Sender: TObject);varws: IFMXWindowService;beginif 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 2009 之 tcategorypanelgroup[3]: color
更多相关阅读请进入《Delphi》频道 >>