세로 방향 (세로 방향) 또는 가로 방향 (가로 방향)인지 여부를 어떻게 알 수 있습니까?Windows Phone 7의 방향을 결정하는 방법은 무엇입니까?
가속도계를 사용하여 "손으로"결정해야하는 API가 있습니까?
세로 방향 (세로 방향) 또는 가로 방향 (가로 방향)인지 여부를 어떻게 알 수 있습니까?Windows Phone 7의 방향을 결정하는 방법은 무엇입니까?
가속도계를 사용하여 "손으로"결정해야하는 API가 있습니까?
나 자신은 방금 7 대 전화 (vs2010 표현식 전화 판을 통해)를 보았다.
그 다음 실제 형태는 방향이 e.Orientation 그것이 무엇인지 방향을 당신에게 말할 것이다 변경 그래서
private void PhoneApplicationPage_OrientationChanging(object sender, OrientationChangedEventArgs e)
{
var test = e.Orientation;
}
을 가지고이
public MainPage()
{
InitializeComponent();
// seems to set the supported orientations that your program will support.
SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
}
뒤에 코드를 갖고있는 것 같아요. 예를 들어 LandscapeRight와 같습니다.
당신도 이것을 통해 질문 할 수 있습니다. 응용 프로그램이 시작되면 오리 엔테이션을 사용하여 방향이 무엇인지 알 수 있습니다. 처음에는 OrientationChanged 이벤트를 사용할 수 있습니다. 에서
주 :
또한OrientationChanged += new EventHandler<OrientationChangedEventArgs>(MainPage_OrientationChanged);
void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
Console.WriteLine(e.Orientation.ToString());
}
경우에만 이벤트를 통해이 문제를 추적 할 필요가 없습니다, 당신은하여 PhoneApplicationPage 인스턴스에서 직접 요청할 수 있습니다 :
private void Button_Click(object sender, RoutedEventArgs e)
{
MyCurrentOrientation.Text = this.Orientation.ToString();
}