本文介绍了如何确定 Windows Phone 7 的方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何判断设备是垂直(纵向)还是水平(横向)定向?
How can you tell whether the device is oriented vertically (portrait) or horizontally (landscape)?
是否有可以简化此操作的 API,或者您是否必须使用加速度计手动"进行确定?
Is there an API that simplifies this or do you have to make the determination "by hand" using the accelerometer?
推荐答案
我自己刚刚看过 windows 7 手机(通过 vs2010 express 手机版).
I myself just have looked at windows 7 phones(through vs2010 express phone edition).
似乎在这背后的代码中
public MainPage()
{
InitializeComponent();
// seems to set the supported orientations that your program will support.
SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
}
那么实际的表格有
private void PhoneApplicationPage_OrientationChanging(object sender, OrientationChangedEventArgs e)
{
var test = e.Orientation;
}
所以当方向改变时,e.Orientation 会告诉你它是什么方向.比如 LandscapeRight.
So when the orientation changes it e.Orientation will tell you what orientation it is. Like for instance LandscapeRight.
这篇关于如何确定 Windows Phone 7 的方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!