2008-11-08 3 views

답변

3

이 장치의 특성의 모든 종류의 트랙을 유지하는 클래스가있다. DisplayRotation 외에 필요한 전화 범위, 부재중 전화 수, 다음 약속 등을 포함합니다. 자세한 내용은 msdn을 참조하십시오.

또한 이러한 속성의 변경을 알리는 이벤트 처리기를 추가 할 수도 있습니다.

0

그냥 추측하지만 내 첫 번째 시도는 다음과 같습니다 Microsoft.WindowsMobile.Status에서

var rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds; 
// or var rect = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; 

var ratio = rect.Width/rect.Height; 

if (ratio == 1.0) // square screen. 
if (ratio > 1.0) // landscape. 
if (ratio < 1.0) // portrait. 
+0

이 작동하지 않습니다,하지만 그것은 새로운 "var"키워드가 다른 방법으로 명백한 문제를 숨기는 데 주로 좋은 방법이라는 좋은 예입니다. – MusiGenesis

2

Microsoft.WindowsCE.Forms에 대한 참조를 프로젝트에 추가하십시오. 그런 다음 Microsoft.WindowsCE.Forms를 참조 할 수 있습니다. SystemSettings.ScreenOrientation 속성은 필요한 것을 제공합니다.

덧붙여이 속성을 설정하여 화면 방향을 설정할 수도 있습니다. 방향을 결정하기 위해이 코드를 사용할 수 있습니다 Microsoft.WindowsMobile Microsoft.WindowsMobile.Status 다음

:

1

당신이 프로젝트에 2 Refrences을 추가해야

int orientation=Microsoft.WindowsMobile.Status.SystemState.DisplayRotation; 
if(orientation== 90 || orientation==-90 || orientation==270) //Landscape is 90 or -90 or 270 
{ 
    //your code; 
} 
else 
{ 
    //your code; 
} 
관련 문제