Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Firemonkey check screen orientation

Digital Innovation Partner

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;