Skip to content

Instantly share code, notes, and snippets.

@an01f01
Created January 25, 2024 16:03
Show Gist options
  • Save an01f01/828c791dc18e161e183889d0eae0b5fb to your computer and use it in GitHub Desktop.
Save an01f01/828c791dc18e161e183889d0eae0b5fb to your computer and use it in GitHub Desktop.
{ Screen Scaling for Device }
function GetScreenScale: Single;
var
ScreenService: IFMXScreenService;
begin
Result := 1;
if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then
begin
Result := ScreenService.GetScreenScale;
end;
end;
{ Screen Size for Device }
function GetScreenSize: TPointF;
var
ScreenService: IFMXScreenService;
begin
Result := TPointF.Zero;
if TPlatformServices.Current.SupportsPlatformService (IFMXScreenService, IInterface(ScreenService)) then
begin
Result := ScreenService.GetScreenSize;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment