缺省情况下,程序是根据手机屏幕的当前方向开始启动的。如果要强制程序以横屏或竖屏的模式启动,那我们在CAknAppUi::ConstructL()方法中调用BaseConstructL()时就要传递相应的flag值:
Code:
void CMyAppUi::ConstructL()
{
BaseConstructL( EAknEnableSkin | EAppOrientationLandscape );
// start in landscape mode
...
}
如果要在程序运行期间改变方向,则需要调用:
Code:
void CAknAppUiBase::SetOrientationL( TAppUiOrientation aOrientation );
这里的参数为EAppUiOrientationLandscape和EAppUiOrientationPortrait,注意这种情况下的调用就不要再向BaseConstructL()中传递相同的参数了。
转载至 http://blog.csdn.net/Max__Payne/archive/2009/02/18/3906734.aspx