Firemonkey check screen orientation
To check with Delphi / Firemonkey if the screen is in Landscape or Portrait mode i use the FMXPlatform library as in the example:
uses FMXPlatform;
…
procedure TForm2.FormResize(Sender: TObject);
var
ScreenService: IFMXScreenService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then
begin
if ScreenService.GetScreenOrientation in [TScreenOrientation.soPortrait, TScreenOrientation.soInvertedPortrait] then
ShowMessage(‘Portrait Orientation’)
else
Begin
ShowMessage(‘Landscape Orientation’);
End;
end;
end;