找传奇、传世资源到传世资源站!

fmx横竖屏切换 示例源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

【例子介绍】fmx横竖屏切换
【相关图片】fmx横竖屏切换 示例源码 Delphi数据库编程-第1张

【源码结构】fmx横竖屏切换

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.Controls.Presentation, FMX.StdCtrls ;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}
 uses
 FMX.Platform;

procedure TForm1.Button1Click(Sender: TObject);
var
  AppService: IFMXScreenService;
  AOrientations: TScreenOrientations ;
  ScreenOrientation:TScreenOrientation;
begin
 if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, AppService) then
  ScreenOrientation:=TScreenOrientation.Portrait;
  AOrientations:=  [ScreenOrientation];
  AppService.SetScreenOrientation(AOrientations);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  AppService: IFMXScreenService;
  AOrientations: TScreenOrientations ;
  ScreenOrientation:TScreenOrientation;
begin
   if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, AppService) then
  ScreenOrientation:=TScreenOrientation.Landscape;
  AOrientations:=  [ScreenOrientation];
  AppService.SetScreenOrientation(AOrientations);

end;

procedure TForm1.Button3Click(Sender: TObject);
var
  AppService: IFMXScreenService;
  AOrientations: TScreenOrientations ;
  ScreenOrientation:TScreenOrientation;
begin
   if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, AppService) then
  ScreenOrientation:=TScreenOrientation.InvertedPortrait;
  AOrientations:=  [ScreenOrientation];
  AppService.SetScreenOrientation(AOrientations);

end;

procedure TForm1.Button4Click(Sender: TObject);

var
  AppService: IFMXScreenService;
  AOrientations: TScreenOrientations ;
  ScreenOrientation:TScreenOrientation;
begin
    if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, AppService) then
  ScreenOrientation:=TScreenOrientation.InvertedLandscape;
  AOrientations:=  [ScreenOrientation];
  AppService.SetScreenOrientation(AOrientations);

end;

end.

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复