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