delphi xe 应用程序横竖屏设置

来源:互联网 发布:专业八级 知乎 编辑:程序博客网 时间:2024/04/30 01:20

http://blog.csdn.net/delphiteacher/article/details/9720831参考这个

1、应用程序禁止竖屏代码

  1.  Application.Initialize;  
  2.   
  3.   //禁止竖屏,只允许横屏 
  4.   Application.FormFactor.Orientations := [TFormOrientation.soLandscape, TFormOrientation.soInvertedLandscape];  
  5.   //禁止横屏,只允许竖屏
  6.   //Application.FormFactor.Orientations := [TFormOrientation.soPortrait, TFormOrientation.soInvertedPortrait];
  7.   
  8.   Application.CreateForm(TForm1, Form1);  
  9.   Application.Run;  

2、工程中设置

在工程管理视图中鼠标右键,在弹出的菜单中选择Options…,在左边的列表中选中Application,在右边面板区域中的Orientation页,勾选Custom orientation,你就可以勾选它下面的四个选项(PortraitUpside downLandscape home rightLandscape home left),其中Landscape home rightLandscape home left表示横屏,PortraitUpside down表示竖屏。

 

当然,它其实也是在工程代码中加上前面我们讲的那句代码。


0 0