Partager via


ScreenOrientation, énumération

Mise à jour : novembre 2007

Spécifie l'angle d'orientation de l'écran du périphérique auquel il est possible d'accéder via la propriété ScreenOrientation.

Espace de noms :  Microsoft.WindowsCE.Forms
Assembly :  Microsoft.WindowsCE.Forms (dans Microsoft.WindowsCE.Forms.dll)

Syntaxe

'Déclaration
Public Enumeration ScreenOrientation
'Utilisation
Dim instance As ScreenOrientation
public enum ScreenOrientation
public enum class ScreenOrientation
public enum ScreenOrientation

Membres

Nom de membre Description
Angle0 Spécifie une orientation portrait à 0 degré.
Angle90 Spécifie une orientation à 90 degrés.
Angle180 Spécifie une orientation paysage à 180 degrés.
Angle270 Spécifie une orientation à 270 degrés.

Notes

L'orientation portrait par défaut est à un angle 0. Requiert la mise à jour de Pocket PC 2003.

Exemples

L'exemple de code suivant montre comment les clics de bouton font pivoter l'orientation de l'écran via l'énumération ScreenOrientation. Cet exemple de code fait partie d'un plus grand exemple fourni pour la classe SystemSettings.

' 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
 // 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 void button1_Click(object sender, System.EventArgs e)
{

 switch(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++;
   break;
  case 1:
   SetOrientation(ScreenOrientation.Angle180);
   x++;
   break;
  case 2:
   SetOrientation(ScreenOrientation.Angle270);
   x++;
   break;
  case 3:
   SetOrientation(ScreenOrientation.Angle0);
   x = 0;
   break;
  default:
   SetOrientation(ScreenOrientation.Angle0);
   x = 0;
   break;
 }
}

 // Set the orientation to a value of the
 // ScreenOrienation enumeration and update the
 // status bar with the current angle.
private void SetOrientation(ScreenOrientation so)
{
 // Set the requested orientation.

 SystemSettings.ScreenOrientation = so;

 this.statusBar1.Text = SystemSettings.ScreenOrientation.ToString();
}

Plateformes

Windows CE, Windows Mobile pour Smartphone, Windows Mobile pour Pocket PC

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Compact Framework

Pris en charge dans : 3.5, 2.0

Voir aussi

Référence

Microsoft.WindowsCE.Forms, espace de noms