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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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; |