This documentation is archived and is not being maintained.

SystemSettings Class

Provides access to user interface settings and native Windows Embedded CE operating system settings on a device.

Namespace:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

'Declaration
Public NotInheritable Class SystemSettings
'Usage
Dim instance As SystemSettings

Currently, this class provides settings for the ScreenOrientation and Platform properties only.

The following example demonstrates how to rotate the screen orientation of a device from the default portrait view at 0 degrees to 90 degrees, to 180 degrees, to 270 degrees, and then back to 0 degrees. The button clicks cycle through the ScreenOrientation enumeration.

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.WindowsCE.Forms



Public Class Form1
   Inherits System.Windows.Forms.Form
   Private WithEvents Button1 As System.Windows.Forms.Button
   Private mainMenu1 As System.Windows.Forms.MainMenu
   Private StatusBar1 As System.Windows.Forms.StatusBar

   ' Set a variable to be incremented by button clicks 
   ' that will change the orientation by rotating 
   ' through the ScreenOrientation enumeration. 
   Private x As Integer = 0


   Public Sub New()
      InitializeComponent()

      Me.MinimizeBox = False 

      ' Set the screen orientation to normal 
      ' and display the value on the status bar.
      SystemSettings.ScreenOrientation = ScreenOrientation.Angle0
      Me.StatusBar1.Text = SystemSettings.ScreenOrientation.ToString()
   End Sub 

   Protected Overrides Sub Dispose(disposing As Boolean)
      MyBase.Dispose(disposing)
   End Sub 

   Private Sub InitializeComponent()
      Me.Button1 = New System.Windows.Forms.Button()
      Me.StatusBar1 = New System.Windows.Forms.StatusBar()
      
      ' Button1 
      
      Me.Button1.Location = New System.Drawing.Point(16, 128)
      Me.Button1.Text = "Rotate" 
      
      ' Form1 
      
      Me.Controls.Add(Button1)
      Me.Controls.Add(StatusBar1)
      Me.Text = "Orientation Demo" 
   End Sub 

   Shared Sub Main()
      Application.Run(New Form1())
   End Sub 


   ' Each click event changes the screen orientation, as determined 
   ' by the variable x, which increments from 0 to 3 and then back 
   ' to 0. Four clicks cycle through the ScreenOrientation enumeration. 
   Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click

      Select Case x
         Case 0

            ' Pass a value for the ScreenOrientation enumeration 
            ' to the SetOrientation method, defined below, 
            ' and increment x so that the next button 
            ' click rotates the screen orientation.
            SetOrientation(ScreenOrientation.Angle90)
            x += 1
         Case 1
            SetOrientation(ScreenOrientation.Angle180)
            x += 1
         Case 2
            SetOrientation(ScreenOrientation.Angle270)
            x += 1
         Case 3
            SetOrientation(ScreenOrientation.Angle0)
            x = 0
         Case Else
            SetOrientation(ScreenOrientation.Angle0)
            x = 0
      End Select 
   End Sub 


   ' Set the orientation to a value of the 
   ' ScreenOrienation enumeration and update the 
   ' status bar with the current angle. 
   Private Sub SetOrientation(so As ScreenOrientation)
      ' Set the requested orientation.
      SystemSettings.ScreenOrientation = so

      Me.StatusBar1.Text = SystemSettings.ScreenOrientation.ToString()
   End Sub 

End Class

System.Object
  Microsoft.WindowsCE.Forms.SystemSettings

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Compact Framework

Supported in: 3.5, 2.0
Show: