ScreenOrientation 枚举

指定可由 ScreenOrientation 属性访问的设备屏幕的取向角。

命名空间:  Microsoft.WindowsCE.Forms
程序集:  Microsoft.WindowsCE.Forms(在 Microsoft.WindowsCE.Forms.dll 中)

语法

声明
Public Enumeration ScreenOrientation
用法
Dim instance As ScreenOrientation
public enum ScreenOrientation
public enum class ScreenOrientation
public enum ScreenOrientation

成员

成员名称 说明
Angle0 指定 0 度的纵向方向。
Angle90 指定 90 度的方向。
Angle180 指定 180 度的横向方向。
Angle270 指定 270 度的方向。

备注

默认的纵向方向为 0 度角。需要 Pocket PC 2003 更新程序。

示例

下面的代码示例演示如何通过 ScreenOrientation 枚举在单击按钮时旋转屏幕方向。此代码示例摘自一个为 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();
}

平台

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

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Compact Framework

受以下版本支持:3.5、2.0

另请参见

参考

Microsoft.WindowsCE.Forms 命名空间