Sunday, October 21, 2007

Determine Current Screen Orientation for Windows Mobile

To find the Screen Orientation on a Windows Mobile device, you can easily check the screen orientation property. Sample VB.NET code is shown below (C# code would be similar):

Imports Microsoft.WindowsCE.Forms
.
.
.
Dim orientation As ScreenOrientation = _
SystemSettings.ScreenOrientation


Orientation will be:
  • ScreenOrientation.Angle0
  • ScreenOrientation.Angle90
  • ScreenOrientation.Angle180
  • ScreenOrientation.Angle270

If the Orientation changes while a form is being displayed, the Resize will be fired.

More Info can be found at: http://msdn2.microsoft.com/en-us/library/ms229671.aspx

No comments: