本文整理自网络,侵删。
应用程序禁止竖屏代码 Application.Initialize; //禁止竖屏,只允许横屏 Application.FormFactor.Orientations := [TFormOrientation.soLandscape, TFormOrientation.soInvertedLandscape]; //禁止横屏,只允许竖屏 //Application.FormFactor.Orientations := [TFormOrientation.soPortrait, TFormOrientation.soInvertedPortrait]; Application.CreateForm(TForm1, Form1); Application.Run;
2、工程中设置
在工程管理视图中鼠标右键,在弹出的菜单中选择Options…,在左边的列表中选中Application,在右边面板区域中的Orientation页,勾选Custom orientation,你就可以勾选它下面的四个选项(Portrait,Upside down,Landscape home right,Landscape home left),其中Landscape home right,Landscape home left表示横屏,Portrait,Upside down表示竖屏。

当然,它其实也是在工程代码中加上前面我们讲的那句代码。
相关阅读 >>
winapi 字符及字符串函数(7): ischarlower - 是否是个小写字母
更多相关阅读请进入《Delphi》频道 >>