FM3中获得屏幕尺寸

FM3中获得屏幕尺寸

本文介绍了如何在Firemonkey FM3中获得屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过Firemonkey FM3获得屏幕尺寸?以下代码:

  var 
大小:TPointF;
begin
大小:= FMX.Platform.IFMXScreenService.GetScreenSize;
...
end;

导致此编译器错误:

  [dcc32错误] Unit1.pas(46):E2018记录,对象或类类型需要

如何使用 IFMXScreenService 界面获取屏幕大小?

解决方案

尝试这样:

  var 
ScreenSize:TSize;
begin
ScreenSize:= Screen.Size;
Caption:= IntToStr(ScreenSize.Width)+'*'+ IntToStr(ScreenSize.Height);
结束


How to get screen dimensions with Firemonkey FM³ ? The following code:

var
  Size: TPointF;
begin
  Size := FMX.Platform.IFMXScreenService.GetScreenSize;
  ...
end;

Results in this compiler error:

[dcc32 Error] Unit1.pas(46): E2018 Record, object or class type required

How should I use IFMXScreenService interface to get screen size ?

解决方案

Try this :

var
  ScreenSize: TSize;
begin
  ScreenSize := Screen.Size;
  Caption := IntToStr(ScreenSize.Width) + '*' + IntToStr(ScreenSize.Height);
end;

这篇关于如何在Firemonkey FM3中获得屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:31