相关资料:
https://www.it1352.com/624177.html
1 unit Unit2; 2 3 interface 4 5 uses 6 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7 FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMXTee.Engine, 8 FMXTee.Procs, FMXTee.Chart, FMX.Layouts, FMX.Controls.Presentation, 9 FMX.StdCtrls; 10 11 type 12 TForm2 = class(TForm) 13 Layout1: TLayout; 14 Chart1: TChart; 15 Layout2: TLayout; 16 Button1: TButton; 17 Button2: TButton; 18 Button3: TButton; 19 Button4: TButton; 20 procedure Button1Click(Sender: TObject); 21 private 22 { Private declarations } 23 public 24 { Public declarations } 25 end; 26 27 var 28 Form2: TForm2; 29 30 implementation 31 uses 32 FMX.Platform; //需要引入 33 {$R *.fmx} 34 {$R *.LgXhdpiPh.fmx ANDROID} 35 36 procedure TForm2.Button1Click(Sender: TObject); 37 var 38 ScreenService: IFMXScreenService; 39 OrientSet: TScreenOrientations; 40 begin 41 if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) 42 then 43 begin 44 OrientSet := [TScreenOrientation.soLandscape]; 45 ScreenService.SetScreenOrientation(OrientSet); 46 end; 47 end; 48 49 end.
原文地址:https://www.cnblogs.com/FKdelphi/p/12657760.html
时间: 2024-10-03 18:00:27