Condividi tramite


Enumerazione ScreenOrientation

Aggiornamento: novembre 2007

Specifica l'angolo per l'orientamento dello schermo del dispositivo a cui è possibile accedere mediante la proprietà ScreenOrientation.

Spazio dei nomi:  Microsoft.WindowsCE.Forms
Assembly:  Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)

Sintassi

'Dichiarazione
Public Enumeration ScreenOrientation
'Utilizzo
Dim instance As ScreenOrientation
public enum ScreenOrientation
public enum class ScreenOrientation
public enum ScreenOrientation

Membri

Nome membro Descrizione
Angle0 Specifica l'orientamento verticale a 0 gradi.
Angle90 Specifica l'orientamento a 90 gradi.
Angle180 Specifica l'orientamento orizzontale a 180 gradi.
Angle270 Specifica l'orientamento a 270 gradi.

Note

L'angolo 0 indica l'orientamento verticale predefinito. Richiede l'aggiornamento a Pocket PC 2003.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato l'effetto di rotazione dei clic sui pulsanti sull'orientamento dello schermo tramite l'enumerazione ScreenOrientation. Questo esempio di codice fa parte di un esempio più esaustivo fornito per 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();
}

Piattaforme

Windows CE, Windows Mobile per Smartphone, Windows Mobile per Pocket PC

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Compact Framework

Supportato in: 3.5, 2.0

Vedere anche

Riferimenti

Spazio dei nomi Microsoft.WindowsCE.Forms